-
Notifications
You must be signed in to change notification settings - Fork 1
/
config-overrides.js
44 lines (40 loc) · 1.13 KB
/
config-overrides.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
/*
* Copyright (c) 2018-present, Evgeny Nadymov
*
* This source code is licensed under the GPL v.3.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const {
override,
addWebpackModuleRule,
} = require('customize-cra');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
function addWebpackBundleAnalyzer(config, options = {}) {
if (process.env.NODE_ENV === 'production'
&& process.argv.indexOf('--bundle-report') !== -1) {
config.plugins = (config.plugins || []).concat([
new BundleAnalyzerPlugin(options),
]);
}
return config;
}
module.exports = override(
config => ({
...config,
output: {
...config.output,
globalObject: 'this',
},
}),
config => addWebpackBundleAnalyzer(config,{
// analyzerMode: 'static',
// reportFilename: 'report.html',
openAnalyzer: true,
generateStatsFile: true,
statsFilename: 'bundle-stats.json'
}),
addWebpackModuleRule({
test: /\.worker\.js$/,
use: { loader: 'worker-loader' },
})
);