Skip to content

Commit 18ae73d

Browse files
committed
Refactor chunk graph
Chunks are now always in ChunkGroups ChunkGroups have parents and children, Chunks no longer have this AsyncDependenciesBlocks point to a ChunkGroup instead of a list of chunks Entrypoint is now a ChunkGroup (extends from it) move stuff graph modification methods into GraphHelpers Change chunk id recording to source-based Chunks have parents, siblings and children in Stats rename AutomaticCommonsChunksPlugin to SplitChunksPlugin add request property to origin (ChunkGroup) remove moveToParent from AggressiveMergingPlugin fix issues with AggressiveSplittingPlugin remove CommonsChunkPlugin add optimization.runtimeChunk (RuntimeChunkPlugin) fix a filename bug for initial chunks remove extract-text-webpack-plugin from test suite add DebugHash to help debugging hash issues fix issues with entry modules in different chunk as runtime redo optimization.splitChunks options Compilation.entrypoints is now a Map Compilation.chunkGroups has been added remove some unittests update examples update tests with CommonsChunkPlugin
1 parent 8b888fe commit 18ae73d

File tree

317 files changed

+5741
-8083
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

317 files changed

+5741
-8083
lines changed

examples/aggressive-merging/README.md

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ module.exports = {
4545
},
4646
plugins: [
4747
new AggressiveMergingPlugin({
48-
minSizeReduce: 1.5,
49-
moveToParents: true
48+
minSizeReduce: 1.5
5049
})
5150
],
5251
optimization: {
@@ -63,44 +62,44 @@ module.exports = {
6362
Hash: 0a1b2c3d4e5f6a7b8c9d
6463
Version: webpack next
6564
Asset Size Chunks Chunk Names
66-
0.chunk.js 5.65 KiB 0 [emitted]
65+
0.chunk.js 5.98 KiB 0 [emitted]
6766
1.chunk.js 405 bytes 1 [emitted]
68-
pageC.bundle.js 7.02 KiB 2 [emitted] pageC
69-
pageB.bundle.js 7.23 KiB 3 [emitted] pageB
70-
pageA.bundle.js 7.21 KiB 4 [emitted] pageA
67+
pageC.bundle.js 7.05 KiB 2 [emitted] pageC
68+
pageB.bundle.js 7.05 KiB 3 [emitted] pageB
69+
pageA.bundle.js 7.05 KiB 4 [emitted] pageA
7170
Entrypoint pageA = pageA.bundle.js
7271
Entrypoint pageB = pageB.bundle.js
7372
Entrypoint pageC = pageC.bundle.js
74-
chunk {0} 0.chunk.js 5.42 KiB {3} {4} [rendered]
75-
> aggressive-merge [5] ./pageA.js 1:0-3:2
76-
> aggressive-merge [4] ./pageB.js 1:0-3:2
73+
chunk {0} 0.chunk.js 5.46 KiB <{3}> <{4}> [rendered]
74+
> ./common [4] ./pageB.js 1:0-3:2
75+
> ./common [5] ./pageA.js 1:0-3:2
76+
[0] ./b.js 21 bytes {0} {1} [built]
77+
cjs require ./b [3] ./pageC.js 2:17-31
78+
cjs require ./b [4] ./pageB.js 2:8-22
79+
[1] ./a.js 21 bytes {0} {1} [built]
80+
amd require ./a [3] ./pageC.js 1:0-3:2
81+
cjs require ./a [5] ./pageA.js 2:8-22
7782
[2] ./common.js 5.42 KiB {0} [built]
7883
amd require ./common [4] ./pageB.js 1:0-3:2
7984
amd require ./common [5] ./pageA.js 1:0-3:2
80-
chunk {1} 1.chunk.js 42 bytes {2} [rendered]
81-
> [3] ./pageC.js 1:0-3:2
82-
[0] ./b.js 21 bytes {1} {3} [built]
85+
chunk {1} 1.chunk.js 42 bytes <{2}> [rendered]
86+
> ./a [3] ./pageC.js 1:0-3:2
87+
[0] ./b.js 21 bytes {0} {1} [built]
8388
cjs require ./b [3] ./pageC.js 2:17-31
8489
cjs require ./b [4] ./pageB.js 2:8-22
85-
[1] ./a.js 21 bytes {1} {4} [built]
90+
[1] ./a.js 21 bytes {0} {1} [built]
8691
amd require ./a [3] ./pageC.js 1:0-3:2
8792
cjs require ./a [5] ./pageA.js 2:8-22
88-
chunk {2} pageC.bundle.js (pageC) 70 bytes [entry] [rendered]
89-
> pageC [3] ./pageC.js
93+
chunk {2} pageC.bundle.js (pageC) 70 bytes >{1}< [entry] [rendered]
94+
> ./pageC pageC
9095
[3] ./pageC.js 70 bytes {2} [built]
9196
single entry ./pageC pageC
92-
chunk {3} pageB.bundle.js (pageB) 92 bytes [entry] [rendered]
93-
> pageB [4] ./pageB.js
94-
[0] ./b.js 21 bytes {1} {3} [built]
95-
cjs require ./b [3] ./pageC.js 2:17-31
96-
cjs require ./b [4] ./pageB.js 2:8-22
97+
chunk {3} pageB.bundle.js (pageB) 71 bytes >{0}< [entry] [rendered]
98+
> ./pageB pageB
9799
[4] ./pageB.js 71 bytes {3} [built]
98100
single entry ./pageB pageB
99-
chunk {4} pageA.bundle.js (pageA) 92 bytes [entry] [rendered]
100-
> pageA [5] ./pageA.js
101-
[1] ./a.js 21 bytes {1} {4} [built]
102-
amd require ./a [3] ./pageC.js 1:0-3:2
103-
cjs require ./a [5] ./pageA.js 2:8-22
101+
chunk {4} pageA.bundle.js (pageA) 71 bytes >{0}< [entry] [rendered]
102+
> ./pageA pageA
104103
[5] ./pageA.js 71 bytes {4} [built]
105104
single entry ./pageA pageA
106105
```
@@ -111,44 +110,44 @@ chunk {4} pageA.bundle.js (pageA) 92 bytes [entry] [rendered]
111110
Hash: 0a1b2c3d4e5f6a7b8c9d
112111
Version: webpack next
113112
Asset Size Chunks Chunk Names
114-
0.chunk.js 115 bytes 0 [emitted]
113+
0.chunk.js 173 bytes 0, 1 [emitted]
115114
1.chunk.js 118 bytes 1 [emitted]
116-
pageC.bundle.js 1.67 KiB 2 [emitted] pageC
117-
pageB.bundle.js 1.69 KiB 3 [emitted] pageB
118-
pageA.bundle.js 1.69 KiB 4 [emitted] pageA
115+
pageC.bundle.js 1.68 KiB 2 [emitted] pageC
116+
pageB.bundle.js 1.66 KiB 3 [emitted] pageB
117+
pageA.bundle.js 1.66 KiB 4 [emitted] pageA
119118
Entrypoint pageA = pageA.bundle.js
120119
Entrypoint pageB = pageB.bundle.js
121120
Entrypoint pageC = pageC.bundle.js
122-
chunk {0} 0.chunk.js 5.42 KiB {3} {4} [rendered]
123-
> aggressive-merge [5] ./pageA.js 1:0-3:2
124-
> aggressive-merge [4] ./pageB.js 1:0-3:2
121+
chunk {0} 0.chunk.js 5.46 KiB <{3}> <{4}> [rendered]
122+
> ./common [4] ./pageB.js 1:0-3:2
123+
> ./common [5] ./pageA.js 1:0-3:2
124+
[0] ./b.js 21 bytes {0} {1} [built]
125+
cjs require ./b [3] ./pageC.js 2:17-31
126+
cjs require ./b [4] ./pageB.js 2:8-22
127+
[1] ./a.js 21 bytes {0} {1} [built]
128+
amd require ./a [3] ./pageC.js 1:0-3:2
129+
cjs require ./a [5] ./pageA.js 2:8-22
125130
[2] ./common.js 5.42 KiB {0} [built]
126131
amd require ./common [4] ./pageB.js 1:0-3:2
127132
amd require ./common [5] ./pageA.js 1:0-3:2
128-
chunk {1} 1.chunk.js 42 bytes {2} [rendered]
129-
> [3] ./pageC.js 1:0-3:2
130-
[0] ./b.js 21 bytes {1} {3} [built]
133+
chunk {1} 1.chunk.js 42 bytes <{2}> [rendered]
134+
> ./a [3] ./pageC.js 1:0-3:2
135+
[0] ./b.js 21 bytes {0} {1} [built]
131136
cjs require ./b [3] ./pageC.js 2:17-31
132137
cjs require ./b [4] ./pageB.js 2:8-22
133-
[1] ./a.js 21 bytes {1} {4} [built]
138+
[1] ./a.js 21 bytes {0} {1} [built]
134139
amd require ./a [3] ./pageC.js 1:0-3:2
135140
cjs require ./a [5] ./pageA.js 2:8-22
136-
chunk {2} pageC.bundle.js (pageC) 70 bytes [entry] [rendered]
137-
> pageC [3] ./pageC.js
141+
chunk {2} pageC.bundle.js (pageC) 70 bytes >{1}< [entry] [rendered]
142+
> ./pageC pageC
138143
[3] ./pageC.js 70 bytes {2} [built]
139144
single entry ./pageC pageC
140-
chunk {3} pageB.bundle.js (pageB) 92 bytes [entry] [rendered]
141-
> pageB [4] ./pageB.js
142-
[0] ./b.js 21 bytes {1} {3} [built]
143-
cjs require ./b [3] ./pageC.js 2:17-31
144-
cjs require ./b [4] ./pageB.js 2:8-22
145+
chunk {3} pageB.bundle.js (pageB) 71 bytes >{0}< [entry] [rendered]
146+
> ./pageB pageB
145147
[4] ./pageB.js 71 bytes {3} [built]
146148
single entry ./pageB pageB
147-
chunk {4} pageA.bundle.js (pageA) 92 bytes [entry] [rendered]
148-
> pageA [5] ./pageA.js
149-
[1] ./a.js 21 bytes {1} {4} [built]
150-
amd require ./a [3] ./pageC.js 1:0-3:2
151-
cjs require ./a [5] ./pageA.js 2:8-22
149+
chunk {4} pageA.bundle.js (pageA) 71 bytes >{0}< [entry] [rendered]
150+
> ./pageA pageA
152151
[5] ./pageA.js 71 bytes {4} [built]
153152
single entry ./pageA pageA
154153
```

examples/aggressive-merging/webpack.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ module.exports = {
1414
},
1515
plugins: [
1616
new AggressiveMergingPlugin({
17-
minSizeReduce: 1.5,
18-
moveToParents: true
17+
minSizeReduce: 1.5
1918
})
2019
],
2120
optimization: {

examples/buildAll.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@ const cmds = examples.map(function(dirname) {
77
return "cd " + dirname + " && node build.js";
88
});
99

10+
let failed = 0;
1011
let i = 0;
1112
for(const cmd of cmds) {
1213
console.log(`[${++i}/${cmds.length}] ${cmd}`);
13-
cp.execSync(cmd, { encoding: "utf-8" });
14+
try {
15+
cp.execSync(cmd, { encoding: "utf-8" });
16+
} catch(e) {
17+
failed++;
18+
console.log(e);
19+
}
1420
}
1521
console.log("done");
22+
if(failed > 0)
23+
console.log(`${failed} failed`);

0 commit comments

Comments
 (0)