Skip to content

Commit bc67522

Browse files
committed
fixes stack overflow with circular dependencies
fixes webpack#5462
1 parent 0059bcf commit bc67522

File tree

9 files changed

+26
-5
lines changed

9 files changed

+26
-5
lines changed

lib/optimize/ConcatenatedModule.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,12 @@ class ConcatenatedModule extends Module {
221221
}
222222

223223
identifier() {
224-
return this._orderedConcatenationList.map(info => info.module.identifier()).join(" ");
224+
return this._orderedConcatenationList.map(info => {
225+
switch(info.type) {
226+
case "concatenated":
227+
return info.module.identifier();
228+
}
229+
}).filter(Boolean).join(" ");
225230
}
226231

227232
readableIdentifier(requestShortener) {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import "./a2";
2+
import "./b1";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import "./b2";
2+
import "./c1";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import "./c2";
2+
import "./a1";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
it("should compile and run fine", function(done) {
2+
Promise.all([
3+
import("./a1"),
4+
import("./b1"),
5+
import("./c1")
6+
]).then(function() { done(); });
7+
});

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hash: 731069e082cf620521ce0fb5d80076a98557894b
1+
Hash: 731069e082cf620521cea66588099dc6439215ab
22
Child
33
Hash: 731069e082cf620521ce
44
Time: Xms
@@ -14,20 +14,20 @@ Child
1414
[9] (webpack)/test/statsCases/scope-hoisting-multi/second.js 177 bytes {4} [built]
1515
[10] (webpack)/test/statsCases/scope-hoisting-multi/lazy_second.js 55 bytes {1} [built]
1616
Child
17-
Hash: 0fb5d80076a98557894b
17+
Hash: a66588099dc6439215ab
1818
Time: Xms
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 bailout: Module is an entry point
2222
[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]
24-
[4] (webpack)/test/statsCases/scope-hoisting-multi/first.js + 1 modules 248 bytes {3} [built]
24+
[4] (webpack)/test/statsCases/scope-hoisting-multi/first.js + 1 modules 248 bytes {4} [built]
2525
ModuleConcatenation bailout: Module is an entry point
2626
ModuleConcatenation bailout: Cannot concat with (webpack)/test/statsCases/scope-hoisting-multi/common.js
2727
ModuleConcatenation bailout: Cannot concat with (webpack)/test/statsCases/scope-hoisting-multi/vendor.js (<- Module is an entry point)
2828
[5] (webpack)/test/statsCases/scope-hoisting-multi/lazy_shared.js 31 bytes {0} [built]
2929
ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: (webpack)/test/statsCases/scope-hoisting-multi/first.js (referenced with import()), (webpack)/test/statsCases/scope-hoisting-multi/second.js (referenced with import())
30-
[6] (webpack)/test/statsCases/scope-hoisting-multi/second.js 177 bytes {4} [built]
30+
[6] (webpack)/test/statsCases/scope-hoisting-multi/second.js 177 bytes {3} [built]
3131
ModuleConcatenation bailout: Module is an entry point
3232
[7] (webpack)/test/statsCases/scope-hoisting-multi/lazy_second.js 55 bytes {1} [built]
3333
ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: (webpack)/test/statsCases/scope-hoisting-multi/second.js (referenced with import())

0 commit comments

Comments
 (0)