-
-
Save nhatphamcdn/cf42298ff24578bad0714dbacf9e016c to your computer and use it in GitHub Desktop.
Revisions
-
Akryum created this gist
Sep 27, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ module.exports = { pages: { pageA: 'src/pageA.js', pageB: 'src/pageB.js', pageC: 'src/pageC.js', }, chainWebpack: config => { const options = module.exports const pages = options.pages const pageKeys = Object.keys(pages) // Long-term caching const IS_VENDOR = /[\\/]node_modules[\\/]/ config.optimization .splitChunks({ cacheGroups: { vendors: { name: 'chunk-vendors', priority: -10, chunks: 'initial', minChunks: 2, test: IS_VENDOR, enforce: true, }, ...pageKeys.map(key => ({ name: `chunk-${key}-vendors`, priority: -11, chunks: chunk => chunk.name === key, test: IS_VENDOR, enforce: true, })), common: { name: 'chunk-common', priority: -20, chunks: 'initial', minChunks: 2, reuseExistingChunk: true, enforce: true, }, }, }) } }