Skip to content

Commit b9009dc

Browse files
committed
fix: Merge webpack splitChunks options
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent 8409b5a commit b9009dc

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

webpack.config.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@ Object.assign(webpackConfig.output, {
3636

3737
webpackConfig.optimization.chunkIds = 'named'
3838
webpackConfig.optimization.splitChunks.cacheGroups = {
39-
defaultVendors: {
40-
test(module) {
41-
return module.resource && module.resource.includes(`${path.sep}node_modules${path.sep}`) &&
42-
!module.resource.includes(`${path.sep}highlight.js${path.sep}`)
43-
},
44-
name: 'vendors',
45-
}
39+
mermaid: {
40+
test: /[\\/]node_modules[\\/](mermaid)[\\/]/,
41+
name: 'mermaid',
42+
},
4643
}
44+
webpackConfig.optimization.splitChunks.minSize = 102400
4745

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

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

65-
webpackConfig.optimization.splitChunks.minSize = 102400
66-
67-
webpackConfig.optimization.splitChunks.cacheGroups = {
68-
mermaid: {
69-
test(module) {
70-
return module.resource && module.resource.includes(`${path.sep}node_modules${path.sep}mermaid`)
71-
},
72-
name: 'mermaid',
73-
},
74-
}
75-
7663
module.exports = webpackConfig

0 commit comments

Comments
 (0)