Skip to content

Commit 4a21aaa

Browse files
committed
chore: bundle analyzer plugin
1 parent d7ebfbe commit 4a21aaa

File tree

3 files changed

+322
-9
lines changed

3 files changed

+322
-9
lines changed

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"pre-commit": "^1.2.2",
1616
"prettier": "^1.5.3",
1717
"webpack": "^3.5.5",
18+
"webpack-bundle-analyzer": "^2.9.1",
1819
"webpack-manifest-plugin": "^1.3.1"
1920
},
2021
"scripts": {
@@ -25,7 +26,10 @@
2526
"lint:staged": "lint-staged"
2627
},
2728
"lint-staged": {
28-
"*.js": ["prettier --write --single-quote --trailing-comma=es5", "git add"]
29+
"*.js": [
30+
"prettier --write --single-quote --trailing-comma=es5",
31+
"git add"
32+
]
2933
},
3034
"pre-commit": "lint:staged",
3135
"repository": {

webpack.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const path = require('path');
22
const webpack = require('webpack');
33
const ManifestPlugin = require('webpack-manifest-plugin');
44
const HappyPack = require('happypack');
5+
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
56

67
const plugins = [
78
new webpack.EnvironmentPlugin({
@@ -37,6 +38,10 @@ const plugins = [
3738
new webpack.NamedModulesPlugin(),
3839
];
3940

41+
if (process.env.NODE_ENV === 'debug') {
42+
plugins.push(new BundleAnalyzerPlugin());
43+
}
44+
4045
if (process.env.NODE_ENV === 'production') {
4146
plugins.push(new webpack.optimize.OccurrenceOrderPlugin());
4247
plugins.push(new webpack.optimize.UglifyJsPlugin({ sourceMap: true }));

0 commit comments

Comments
 (0)