forked from WizTeam/WizNoteLite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-overrides.js
45 lines (39 loc) · 1016 Bytes
/
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
45
/* config-overrides.js */
const { setWebpackOptimizationSplitChunks, useBabelRc, override } = require('customize-cra');
const path = require('path');
const HOMEPAGE = process.argv.filter((arg) => {
if (arg.match(/HOMEPAGE=.+/ig)) {
return true;
}
return false;
});
const config = override(
setWebpackOptimizationSplitChunks({
chunks: 'async',
minSize: 30000,
maxSize: 1024000,
minChunks: 1,
maxAsyncRequests: 6,
maxInitialRequests: 4,
automaticNameDelimiter: '~',
cacheGroups: {
defaultVendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10,
},
default: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true,
},
},
}),
useBabelRc(),
);
config.paths = (paths/* , env */) => {
// eslint-disable-next-line no-param-reassign
paths.appBuild = path.join(__dirname, 'web-app');
return paths;
};
process.env.PUBLIC_URL = HOMEPAGE.join('').replace(/HOMEPAGE=/ig, '');
module.exports = config;