mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-12 14:16:12 +01:00
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
@ -44,13 +44,16 @@ function reducePacks (data, into = {}) {
|
||||
return into;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
entry: Object.assign(
|
||||
const entries = Object.assign(
|
||||
{ locales: resolve('app', 'javascript', 'locales') },
|
||||
localePacks,
|
||||
reducePacks(core),
|
||||
Object.keys(flavours).reduce((map, entry) => reducePacks(flavours[entry], map), {})
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
module.exports = {
|
||||
entry: entries,
|
||||
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
@ -67,11 +70,14 @@ module.exports = {
|
||||
cacheGroups: {
|
||||
default: false,
|
||||
vendors: false,
|
||||
locales: {
|
||||
name: 'locales',
|
||||
chunks: 'all',
|
||||
minChunks: Infinity,
|
||||
common: {
|
||||
name: 'common',
|
||||
chunks (chunk) {
|
||||
return !(chunk.name in entries);
|
||||
},
|
||||
minChunks: 2,
|
||||
minSize: 0,
|
||||
test: /^(?!.*[\\\/]node_modules[\\\/]react-intl[\\\/]).+$/,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user