diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-06-30 09:03:10 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-07-14 15:54:44 +0300 |
commit | fb2d8094c1ba1ce78ca185fedaabc44fa8b3b0d7 (patch) | |
tree | 9c6ea6adda28bb7c57a0b9163c59d956bf063ffc /webpack.js | |
parent | 0b5ef3d791bb71fa3fb992e5c6f932bf639b5d68 (diff) |
Fix chunk generation
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'webpack.js')
-rw-r--r-- | webpack.js | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/webpack.js b/webpack.js index c4ccd2252..0444d4018 100644 --- a/webpack.js +++ b/webpack.js @@ -9,21 +9,17 @@ webpackConfig.entry = { viewer: path.join(__dirname, 'src', 'viewer.js'), } -webpackConfig.output.chunkFilename = '[name].js?v=[contenthash]' -webpackConfig.optimization.splitChunks.chunks = 'all' -Object.assign(webpackConfig.optimization.splitChunks, { - cacheGroups: { - highlight: { - enforce: true, - test: /[\\/]node_modules[\\/](hightlight\.js)[\\/]/, +webpackConfig.output.chunkFilename = '[id].js?v=[contenthash]' + +webpackConfig.optimization.chunkIds = 'named' +webpackConfig.optimization.splitChunks.cacheGroups = { + defaultVendors: { + test(module) { + return module.resource && module.resource.includes(`${path.sep}node_modules${path.sep}`) && + !module.resource.includes(`${path.sep}highlight.js${path.sep}`) }, - vendors: { - test: /[\\/]node_modules[\\/]/, - reuseExistingChunk: true - } + name: 'vendors', } -}) - -console.log(webpackConfig) +} module.exports = webpackConfig |