Browse Source

Lighter bundle (#617)

* Drop process shim

* Limit AVA-specific transform to AVA

* Remove old dependency

* Optimize code via babili
master
Federico Brigante 7 years ago
committed by Sindre Sorhus
parent
commit
0f2b18fa40
  1. 32
      package.json
  2. 3
      webpack.config.js

32
package.json

@ -1,13 +1,13 @@
{ {
"scripts": { "scripts": {
"test": "xo && ava && npm run build", "test": "xo && BABEL_ENV=testing ava && npm run build",
"build": "webpack", "build": "webpack",
"watch": "webpack --watch", "watch": "webpack --watch",
"watch:sourcemap": "webpack --watch --devtool eval-cheap-module-source-map", "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:amo": "cd extension && webext submit",
"release:cws": "cd extension && webstore upload --auto-publish", "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)" "update-version": "dot-json extension/manifest.json version $(date -u +%y.%-m.%-d.%-H%M)"
}, },
"dependencies": { "dependencies": {
@ -31,7 +31,6 @@
"babel-cli": "^6.24.1", "babel-cli": "^6.24.1",
"babel-core": "^6.25.0", "babel-core": "^6.25.0",
"babel-loader": "^7.1.1", "babel-loader": "^7.1.1",
"babel-plugin-jsx": "^1.2.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"babel-plugin-transform-react-jsx": "^6.24.1", "babel-plugin-transform-react-jsx": "^6.24.1",
"chrome-webstore-upload-cli": "^1.0.0", "chrome-webstore-upload-cli": "^1.0.0",
@ -73,9 +72,7 @@
] ]
}, },
"babel": { "babel": {
"comments": false,
"plugins": [ "plugins": [
"transform-es2015-modules-commonjs",
[ [
"transform-react-jsx", "transform-react-jsx",
{ {
@ -83,6 +80,29 @@
"useBuiltIns": true "useBuiltIns": true
} }
] ]
],
"env": {
"testing": {
"plugins": [
"transform-es2015-modules-commonjs"
] ]
},
"production": {
"minified": false,
"presets": [
[
"babili",
{
"deadcode": {
"optimizeRawSize": true
},
"mangle": false,
"removeConsole": false,
"simplify": false
}
]
]
}
}
} }
} }

3
webpack.config.js

@ -9,6 +9,9 @@ module.exports = {
options: './src/options' options: './src/options'
}, },
plugins: [ plugins: [
new webpack.DefinePlugin({
process: '0'
}),
new webpack.optimize.ModuleConcatenationPlugin() new webpack.optimize.ModuleConcatenationPlugin()
], ],
output: { output: {

Loading…
Cancel
Save