Skip to content

Commit bd8c6cf

Browse files
committed
make sure ConcatenatedModules also uses SortedSet
fix tests that was falsy - per default chunks are flagged as sorted in module however this only holds true as they are initialized empty. Concatenated module however has initial modules and therefore is not guaranteed to be ordered, the flags should therfor be false. Using SortedSet fixes this as a sideeffect
1 parent 4e5ef0d commit bd8c6cf

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎lib/optimize/ConcatenatedModule.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
const Module = require("../Module");
88
const Template = require("../Template");
99
const Parser = require("../Parser");
10+
const SortedSet = require("../util/SortableSet");
1011
const acorn = require("acorn");
1112
const escope = require("escope");
1213
const ReplaceSource = require("webpack-sources/lib/ReplaceSource");
@@ -135,7 +136,7 @@ class ConcatenatedModule extends Module {
135136
this.providedExports = rootModule.providedExports;
136137
this.optimizationBailout = rootModule.optimizationBailout;
137138
this.used = rootModule.used;
138-
this._chunks = new Set(rootModule._chunks);
139+
this._chunks = new SortedSet(rootModule._chunks, Module.sortById);
139140
this.index = rootModule.index;
140141
this.index2 = rootModule.index2;
141142
this.depth = rootModule.depth;

‎test/statsCases/scope-hoisting-multi/expected.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Child
1919
[0] (webpack)/test/statsCases/scope-hoisting-multi/common_lazy_shared.js 25 bytes {0} {1} {2} [built]
2020
[1] (webpack)/test/statsCases/scope-hoisting-multi/vendor.js 25 bytes {5} [built]
2121
ModuleConcatenation (inner): module is an entrypoint
22-
[2] (webpack)/test/statsCases/scope-hoisting-multi/common.js + 1 modules 62 bytes {4} {3} [built]
22+
[2] (webpack)/test/statsCases/scope-hoisting-multi/common.js + 1 modules 62 bytes {3} {4} [built]
2323
[3] (webpack)/test/statsCases/scope-hoisting-multi/common_lazy.js 25 bytes {1} {2} [built]
2424
[4] (webpack)/test/statsCases/scope-hoisting-multi/first.js + 1 modules 238 bytes {4} [built]
2525
ModuleConcatenation (inner): module is an entrypoint

0 commit comments

Comments
 (0)