Add webpack-bundle-analyzer as dev-tool (#591)

* Add webpack-bundle-analyzer as dev-tool

* Add README information about bundle analysis
This commit is contained in:
Erik Michelson 2020-09-20 23:22:37 +02:00 committed by GitHub
parent 985abe230e
commit 23972ffb16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 89 additions and 6 deletions

View file

@ -1,4 +1,6 @@
const CopyPlugin = require('copy-webpack-plugin');
const { when } = require('@craco/craco');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
module.exports = {
webpack: {
@ -9,6 +11,12 @@ module.exports = {
{ from: 'node_modules/@hpcc-js/wasm/dist/expatlib.wasm', to: 'static/js' }
],
}),
...when(Boolean(process.env.ANALYZE), () => [
new BundleAnalyzerPlugin({
analyzerMode: "static",
generateStatsFile: true
})
], [])
],
},
}