ADD webpack to measure build-size

pull/15/head
pubkey 6 years ago
parent ffa744bdd1
commit 2e8b90110a
  1. 28
      config/webpack.config.js
  2. 9
      package.json

@ -0,0 +1,28 @@
const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
//console.log(process.env.NODE_ENV);
//process.exit();
const plugins = [];
if (process.env.NODE_ENV === 'disc')
plugins.push(new BundleAnalyzerPlugin());
module.exports = {
mode: 'production',
entry: './dist/es/browserify.index.js',
optimization: {
minimizer: [
new UglifyJsPlugin()
]
},
plugins,
output: {
path: path.resolve(__dirname, '../test_tmp'),
filename: 'webpack.bundle.js'
}
};

@ -32,7 +32,9 @@
"build:es5": "cross-env NODE_ENV=es5 node node_modules/babel-cli/bin/babel.js src --out-dir dist/lib",
"build:test": "cross-env NODE_ENV=es5 node node_modules/babel-cli/bin/babel.js test --out-dir test_tmp",
"build": "npm run clear && concurrently \"npm run build:es6\" \"npm run build:es5\" \"npm run build:test\" \"npm run build:sol\"",
"disc": "npm run build && browserify dist/lib/index.js --no-builtins --full-paths | uglifyjs --compress --mangle | discify --open --full-paths"
"build:webpack": "npm run build && cross-env NODE_ENV=build webpack --config ./config/webpack.config.js",
"build:size": "npm run build:webpack && echo \"Build-Size (minified+gzip):\" && gzip-size --raw ./test_tmp/webpack.bundle.js",
"disc": "npm run build && cross-env NODE_ENV=disc webpack --config ./config/webpack.config.js"
},
"repository": {
"type": "git",
@ -106,6 +108,9 @@
"ethereumjs-util": "5.2.0",
"secp256k1": "3.5.0",
"web3-eth-contract": "1.0.0-beta.34",
"web3-utils": "1.0.0-beta.34"
"web3-utils": "1.0.0-beta.34",
"webpack": "4.15.1",
"webpack-bundle-analyzer": "2.13.1",
"webpack-cli": "3.0.8"
}
}

Loading…
Cancel
Save