-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig-overrides.js
More file actions
28 lines (28 loc) · 935 Bytes
/
config-overrides.js
File metadata and controls
28 lines (28 loc) · 935 Bytes
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
module.exports = {
webpack(config) {
config.optimization.splitChunks = {
/*
Webpack has some clever defaults that aren’t so clever, like a maximum
of 3 files when splitting the output files, and a minimum file size of 30
KB (all smaller files would be joined together). So I have overridden these.
*/
minSize: 0,
chunks: 'all',
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name(module) {
// get the name. E.g. node_modules/packageName/not/this/part.js
// or node_modules/packageName
const packageName = module.context.match(
/[\\/]node_modules[\\/](.*?)([\\/]|$)/
)[1]
// npm package names are URL-safe, but some servers don't like @ symbols
return `npm.${packageName.replace('@', '')}`
}
}
}
}
return config
}
}