Add bundle analyzer
This commit is contained in:
parent
a3f12cd4de
commit
4138c580bc
@ -114,6 +114,7 @@
|
|||||||
"typescript": "3.0.1",
|
"typescript": "3.0.1",
|
||||||
"uglifyjs-webpack-plugin": "^2.0.1",
|
"uglifyjs-webpack-plugin": "^2.0.1",
|
||||||
"webpack": "^4.20.2",
|
"webpack": "^4.20.2",
|
||||||
|
"webpack-bundle-analyzer": "^3.0.3",
|
||||||
"webpack-cli": "3.1.2",
|
"webpack-cli": "3.1.2",
|
||||||
"webpack-dev-server": "^3.1.9"
|
"webpack-dev-server": "^3.1.9"
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ const webpack = require('webpack');
|
|||||||
const TerserPlugin = require('terser-webpack-plugin');
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');
|
const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');
|
||||||
const childProcess = require('child_process');
|
const childProcess = require('child_process');
|
||||||
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||||
|
|
||||||
const GIT_SHA = childProcess
|
const GIT_SHA = childProcess
|
||||||
.execSync('git rev-parse HEAD')
|
.execSync('git rev-parse HEAD')
|
||||||
@ -115,6 +116,9 @@ module.exports = (_env, argv) => {
|
|||||||
let plugins = [];
|
let plugins = [];
|
||||||
if (argv.mode === 'development') {
|
if (argv.mode === 'development') {
|
||||||
config.mode = 'development';
|
config.mode = 'development';
|
||||||
|
plugins.concat([
|
||||||
|
new BundleAnalyzerPlugin(),
|
||||||
|
]);
|
||||||
} else {
|
} else {
|
||||||
config.mode = 'production';
|
config.mode = 'production';
|
||||||
plugins = plugins.concat([
|
plugins = plugins.concat([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user