diff --git a/package.json b/package.json index 1ff7ed7..a2e4f30 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "scripts": { - "test": "xo && ava && npm run build", + "test": "xo && BABEL_ENV=testing ava && npm run build", "build": "webpack", "watch": "webpack --watch", "watch:sourcemap": "webpack --watch --devtool eval-cheap-module-source-map", - "reduce-size": "babel --out-dir . --no-comments extension/*.js", + "reduce-size": "BABEL_ENV=production babel --out-dir . extension/content.js", "release:amo": "cd extension && webext submit", "release:cws": "cd extension && webstore upload --auto-publish", - "release": "run-s build update-version release:* reduce-size", + "release": "BABEL_ENV=production run-s build reduce-size update-version release:*", "update-version": "dot-json extension/manifest.json version $(date -u +%y.%-m.%-d.%-H%M)" }, "dependencies": { @@ -31,7 +31,6 @@ "babel-cli": "^6.24.1", "babel-core": "^6.25.0", "babel-loader": "^7.1.1", - "babel-plugin-jsx": "^1.2.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", "babel-plugin-transform-react-jsx": "^6.24.1", "chrome-webstore-upload-cli": "^1.0.0", @@ -73,9 +72,7 @@ ] }, "babel": { - "comments": false, "plugins": [ - "transform-es2015-modules-commonjs", [ "transform-react-jsx", { @@ -83,6 +80,29 @@ "useBuiltIns": true } ] - ] + ], + "env": { + "testing": { + "plugins": [ + "transform-es2015-modules-commonjs" + ] + }, + "production": { + "minified": false, + "presets": [ + [ + "babili", + { + "deadcode": { + "optimizeRawSize": true + }, + "mangle": false, + "removeConsole": false, + "simplify": false + } + ] + ] + } + } } } diff --git a/webpack.config.js b/webpack.config.js index fe44341..f928e24 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,6 +9,9 @@ module.exports = { options: './src/options' }, plugins: [ + new webpack.DefinePlugin({ + process: '0' + }), new webpack.optimize.ModuleConcatenationPlugin() ], output: {