forked from Uniswap/interface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-overrides.js
42 lines (39 loc) · 1.16 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
const rewireStyledComponents = require('react-app-rewire-styled-components')
const CompressionPlugin = require("compression-webpack-plugin");
/* config-overrides.js */
module.exports = function override(config, env) {
config = rewireStyledComponents(config, env)
config.optimization = {
...config.optimization,
moduleIds: 'named',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/](ethers|@ethersproject)[\\/]/,
name: 'ethers',
chunks: 'all'
},
commons: {
test: /[\\/]node_modules[\\/]/,
// cacheGroupKey here is `commons` as the key of the cacheGroup
name(module, chunks, cacheGroupKey) {
const moduleFileName = module
.identifier()
.split('/')
.reduceRight((item) => item);
const allChunksNames = chunks.map((item) => item.name).join('~');
return `${cacheGroupKey}-${allChunksNames}-${moduleFileName}`;
},
chunks: 'all',
},
}
}
}
return {
...config,
plugins: [
...config.plugins,
new CompressionPlugin()
]
}
}