Skip to content

Commit d043323

Browse files
committed
update commons/vendor chunk example
1 parent dc90e70 commit d043323

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

examples/common-chunk-and-vendor-chunk/template.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,16 @@ With this bundle configuration, you would load your third party libraries, then
4343
{{dist/vendor.js}}
4444
```
4545

46-
# dist/common.js
46+
# dist/commons~pageA~pageB~pageC.js
4747

4848
``` javascript
49-
{{dist/common.js}}
49+
{{dist/commons~pageA~pageB~pageC.js}}
50+
```
51+
52+
# dist/commons~pageB~pageC.js
53+
54+
``` javascript
55+
{{dist/commons~pageB~pageC.js}}
5056
```
5157

5258
# dist/pageA.js

examples/common-chunk-and-vendor-chunk/webpack.config.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ module.exports = {
99
},
1010
optimization: {
1111
splitChunks: {
12-
chunks: "initial",
13-
minSize: 0, // This is example is too small to create commons chunks
14-
name: "common",
1512
cacheGroups: {
13+
commons: {
14+
chunks: "initial",
15+
minChunks: 2,
16+
minSize: 0 // This is example is too small to create commons chunks
17+
},
1618
vendor: {
1719
test: /node_modules/,
20+
chunks: "initial",
1821
name: "vendor",
1922
enforce: true
2023
}

0 commit comments

Comments
 (0)