diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-07-28 16:42:13 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2018-07-28 23:24:41 +0200 |
commit | 7317b7b2313bdddf3b2d3a6c4fa7f00f2cc0f645 (patch) | |
tree | 11ea958964e48d0a86c653cfccbaeb8fc394304d /config | |
parent | d3783b864c8881bc3d59b5aa42a70d35869ffef6 (diff) |
Reduce assets precompilation time by about 20%
Bundle most common webpack chunks into a “common” pack, in a way similar to what upstream does.
Diffstat (limited to 'config')
-rw-r--r-- | config/webpack/shared.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/config/webpack/shared.js b/config/webpack/shared.js index 6b6629a37..58eab4b4c 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -44,13 +44,16 @@ function reducePacks (data, into = {}) { return into; } +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: Object.assign( - { locales: resolve('app', 'javascript', 'locales') }, - localePacks, - reducePacks(core), - Object.keys(flavours).reduce((map, entry) => reducePacks(flavours[entry], map), {}) - ), + 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[\\\/]).+$/, }, }, }, |