diff --git a/.eslintrc.json b/.eslintrc.json index 3d157716f..8b21a1523 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,6 +7,9 @@ "es6": true, "node": true }, + "overrides": [ + { "files": ["*.browser.js"], "env": { "browser": true } } + ], "rules": { "no-await-in-loop": "warn", "no-compare-neg-zero": "error", diff --git a/browser.js b/browser.js deleted file mode 100644 index 9f9341efc..000000000 --- a/browser.js +++ /dev/null @@ -1,9 +0,0 @@ -const browser = typeof window !== 'undefined'; -const webpack = !!process.env.__DISCORD_WEBPACK__; - -const Discord = require('./'); - -module.exports = Discord; -if (browser && webpack) window.Discord = Discord; // eslint-disable-line no-undef -// eslint-disable-next-line no-console -else if (!browser) console.warn('Warning: Attempting to use browser version of Discord.js in a non-browser environment!'); diff --git a/package.json b/package.json index bf9e07d8e..f9697693b 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "test": "npm run lint && npm run docs:test", "docs": "docgen --source src --custom docs/index.yml --output docs/docs.json --jsdoc jsdoc.json", "docs:test": "docgen --source src --custom docs/index.yml --jsdoc jsdoc.json", - "lint": "eslint src", + "lint": "eslint src *.js", "lint:fix": "eslint --fix src", "webpack": "parallel-webpack" }, diff --git a/webpack.config.js b/webpack.config.js index 5dc53a8cb..f38376ec8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -12,11 +12,6 @@ const createConfig = options => { const plugins = [ new webpack.DefinePlugin({ 'global.GENTLY': false }), new webpack.optimize.ModuleConcatenationPlugin(), - new webpack.DefinePlugin({ - 'process.env': { - __DISCORD_WEBPACK__: '"true"', - }, - }), ]; if (options.minify) { @@ -31,10 +26,12 @@ const createConfig = options => { const filename = `./webpack/discord${process.env.VERSIONED === 'false' ? '' : '.' + version}${options.minify ? '.min' : ''}.js`; // eslint-disable-line return { - entry: './browser.js', + entry: './src/index.js', output: { path: __dirname, filename, + library: 'Discord', + libraryTarget: 'window', }, module: { rules: [