Skip to content

Commit

Permalink
fix: Merge webpack splitChunks options
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliushaertl committed Nov 29, 2023
1 parent 8409b5a commit b9009dc
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ Object.assign(webpackConfig.output, {

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}`)
},
name: 'vendors',
}
mermaid: {
test: /[\\/]node_modules[\\/](mermaid)[\\/]/,
name: 'mermaid',
},
}
webpackConfig.optimization.splitChunks.minSize = 102400

// Fix Buffer issues
webpackConfig.plugins.push(new webpack.ProvidePlugin({
Expand All @@ -62,15 +60,4 @@ webpackRules.RULE_RAW_SVGS = {

webpackConfig.module.rules = Object.values(webpackRules)

webpackConfig.optimization.splitChunks.minSize = 102400

webpackConfig.optimization.splitChunks.cacheGroups = {
mermaid: {
test(module) {
return module.resource && module.resource.includes(`${path.sep}node_modules${path.sep}mermaid`)
},
name: 'mermaid',
},
}

module.exports = webpackConfig

0 comments on commit b9009dc

Please sign in to comment.