Skip to content

Commit 504148c

Browse files
committed
add test cases for webpack#7401
1 parent 67fa81f commit 504148c

File tree

6 files changed

+52
-0
lines changed

6 files changed

+52
-0
lines changed

test/__snapshots__/StatsTestCases.test.js.snap

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2571,6 +2571,25 @@ chunk {3} vendors.js (vendors) 20 bytes ={2}= >{0}< >{1}< [initial] [rendered
25712571
[4] ./node_modules/y.js 20 bytes {3} [built]"
25722572
`;
25732573

2574+
exports[`StatsTestCases should print correct stats for split-chunks-issue-7401 1`] = `
2575+
"Entrypoint a = vendors~a~c.js a.js
2576+
Entrypoint b = b.js
2577+
Chunk Group c = vendors~a~c.js c.js
2578+
chunk {0} vendors~a~c.js (vendors~a~c) 20 bytes <{3}> ={1}= ={2}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~c)
2579+
> ./a a
2580+
> ./c [3] ./b.js 1:0-41
2581+
[0] ./node_modules/x.js 20 bytes {0} [built]
2582+
chunk {1} c.js (c) 12 bytes <{3}> ={0}= [rendered]
2583+
> ./c [3] ./b.js 1:0-41
2584+
[1] ./c.js 12 bytes {1} [built]
2585+
chunk {2} a.js (a) 12 bytes ={0}= [entry] [rendered]
2586+
> ./a a
2587+
[2] ./a.js 12 bytes {2} [built]
2588+
chunk {3} b.js (b) 43 bytes >{0}< >{1}< [entry] [rendered]
2589+
> ./b b
2590+
[3] ./b.js 43 bytes {3} [built]"
2591+
`;
2592+
25742593
exports[`StatsTestCases should print correct stats for split-chunks-prefer-bigger-splits 1`] = `
25752594
"Entrypoint main = default/main.js
25762595
chunk {0} default/async-b~async-c.js (async-b~async-c) 110 bytes <{4}> ={2}= ={3}= [rendered] split chunk (cache group: default) (name: async-b~async-c)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "x";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import(/* webpackChunkName: "c" */ "./c");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "x";

test/statsCases/split-chunks-issue-7401/node_modules/x.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const stats = {
2+
hash: false,
3+
timings: false,
4+
builtAt: false,
5+
assets: false,
6+
chunks: true,
7+
chunkOrigins: true,
8+
entrypoints: true,
9+
chunkGroups: true,
10+
modules: false
11+
};
12+
module.exports = {
13+
name: "default",
14+
mode: "production",
15+
entry: {
16+
a: "./a",
17+
b: "./b"
18+
},
19+
output: {
20+
filename: "[name].js"
21+
},
22+
optimization: {
23+
splitChunks: {
24+
minSize: 0, // enforce all
25+
chunks: "all"
26+
}
27+
},
28+
stats
29+
};

0 commit comments

Comments
 (0)