Enable BundleAnalyzerPlugin + remove 'yarn analyze'
Use the env to opt in.
This commit is contained in:
parent
d211450b5b
commit
b508fe8679
2 changed files with 12 additions and 1 deletions
|
@ -20,7 +20,6 @@
|
||||||
},
|
},
|
||||||
"main": "./dist/electron/main.js",
|
"main": "./dist/electron/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"analyze": "yarn compile && source-map-explorer --no-border-checks web/dist/public/*.js --html analyzeResults.html",
|
|
||||||
"compile:electron": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.electron.config.js",
|
"compile:electron": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.electron.config.js",
|
||||||
"compile:web": "yarn copyenv && cd web && node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.config.js",
|
"compile:web": "yarn copyenv && cd web && node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.config.js",
|
||||||
"compile": "cross-env NODE_ENV=production yarn compile:electron && cross-env NODE_ENV=production yarn compile:web",
|
"compile": "cross-env NODE_ENV=production yarn compile:electron && cross-env NODE_ENV=production yarn compile:web",
|
||||||
|
|
|
@ -10,6 +10,17 @@ const { ifProduction } = getIfUtils(NODE_ENV);
|
||||||
const UI_ROOT = path.resolve(__dirname, 'ui/');
|
const UI_ROOT = path.resolve(__dirname, 'ui/');
|
||||||
const STATIC_ROOT = path.resolve(__dirname, 'static/');
|
const STATIC_ROOT = path.resolve(__dirname, 'static/');
|
||||||
|
|
||||||
|
const optInPlugins = [];
|
||||||
|
|
||||||
|
if (NODE_ENV !== 'development' && process.env.BUNDLE_ANALYZER_ENABLED) {
|
||||||
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||||
|
optInPlugins.push(new BundleAnalyzerPlugin({
|
||||||
|
analyzerMode: 'static',
|
||||||
|
openAnalyzer: false,
|
||||||
|
reportFilename: process.env.BUNDLE_ANALYZER_FILENAME || 'report.html',
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
let baseConfig = {
|
let baseConfig = {
|
||||||
mode: ifProduction('production', 'development'),
|
mode: ifProduction('production', 'development'),
|
||||||
devtool: ifProduction('source-map', 'eval-cheap-module-source-map'),
|
devtool: ifProduction('source-map', 'eval-cheap-module-source-map'),
|
||||||
|
@ -110,6 +121,7 @@ let baseConfig = {
|
||||||
silent: false, // hide any errors
|
silent: false, // hide any errors
|
||||||
defaults: true, // load '.env.defaults' as the default values if empty.
|
defaults: true, // load '.env.defaults' as the default values if empty.
|
||||||
}),
|
}),
|
||||||
|
...optInPlugins,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
module.exports = baseConfig;
|
module.exports = baseConfig;
|
||||||
|
|
Loading…
Add table
Reference in a new issue