-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbundle-analyzer.config.js
45 lines (42 loc) · 1.22 KB
/
bundle-analyzer.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// bundle-analyzer.config.js
// returns a webpack config object for generating file banners
// webpack plugins
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
// return a webpack config
// eslint-disable-next-line @typescript-eslint/no-unused-vars
module.exports = (type = 'modern', settings) => {
// common config
const common = (filename) => ({
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: filename,
}),
],
});
// configs
const configs = {
// development configs
development: {
// legacy development config
legacy: {
},
// modern development config
modern: {
...common('report-modern.html'),
},
},
// production configs
production: {
// legacy production config
legacy: {
...common('report-legacy.html'),
},
// modern production config
modern: {
...common('report-modern.html'),
},
}
};
return configs[process.env.NODE_ENV][type];
}