Reduce assets precompilation time by about 20%
Bundle most common webpack chunks into a “common” pack, in a way similar to what upstream does.
This commit is contained in:
parent
d3783b864c
commit
7317b7b231
1 changed files with 16 additions and 10 deletions
|
@ -44,13 +44,16 @@ function reducePacks (data, into = {}) {
|
||||||
return into;
|
return into;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
const entries = Object.assign(
|
||||||
entry: Object.assign(
|
|
||||||
{ locales: resolve('app', 'javascript', 'locales') },
|
{ locales: resolve('app', 'javascript', 'locales') },
|
||||||
localePacks,
|
localePacks,
|
||||||
reducePacks(core),
|
reducePacks(core),
|
||||||
Object.keys(flavours).reduce((map, entry) => reducePacks(flavours[entry], map), {})
|
Object.keys(flavours).reduce((map, entry) => reducePacks(flavours[entry], map), {})
|
||||||
),
|
);
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: entries,
|
||||||
|
|
||||||
output: {
|
output: {
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
|
@ -67,11 +70,14 @@ module.exports = {
|
||||||
cacheGroups: {
|
cacheGroups: {
|
||||||
default: false,
|
default: false,
|
||||||
vendors: false,
|
vendors: false,
|
||||||
locales: {
|
common: {
|
||||||
name: 'locales',
|
name: 'common',
|
||||||
chunks: 'all',
|
chunks (chunk) {
|
||||||
minChunks: Infinity,
|
return !(chunk.name in entries);
|
||||||
|
},
|
||||||
|
minChunks: 2,
|
||||||
minSize: 0,
|
minSize: 0,
|
||||||
|
test: /^(?!.*[\\\/]node_modules[\\\/]react-intl[\\\/]).+$/,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue