Skip to content

Commit 45a18a8

Browse files
authored
Merge pull request webpack#7373 from webpack/bugfix/circular-chunks
fix problems with circular unneeded chunks
2 parents 6ff5b8f + 19015b6 commit 45a18a8

File tree

7 files changed

+48
-3
lines changed

7 files changed

+48
-3
lines changed

lib/Compilation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ class Compilation extends Tapable {
865865
this.assignIndex(module);
866866
this.assignDepth(module);
867867
}
868-
this.processDependenciesBlocksForChunkGroups(this.chunkGroups);
868+
this.processDependenciesBlocksForChunkGroups(this.chunkGroups.slice());
869869
this.sortModules(this.modules);
870870
this.hooks.optimize.call();
871871

test/__snapshots__/StatsTestCases.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,7 @@ cir2 from cir1.js 359 bytes 5, 3 [emitted] cir2 from cir1
13801380
chunk.js 190 bytes 6, 7 [emitted] chunk
13811381
ac in ab.js 130 bytes 7 [emitted] ac in ab
13821382
Entrypoint main = main.js
1383-
chunk {0} cir1.js (cir1) 81 bytes <{3}> <{4}> <{5}> >{5}< [rendered]
1383+
chunk {0} cir1.js (cir1) 81 bytes <{3}> <{4}> >{5}< [rendered]
13841384
> [3] ./circular2.js 1:0-79
13851385
> [3] ./circular2.js 1:0-79
13861386
> [8] ./index.js 13:0-54
@@ -1401,7 +1401,7 @@ chunk {4} main.js (main) 523 bytes >{0}< >{1}< >{2}< >{3}< [entry] [rendered]
14011401
> ./index main
14021402
[4] ./modules/f.js 0 bytes {4} [built]
14031403
[8] ./index.js 523 bytes {4} [built]
1404-
chunk {5} cir2 from cir1.js (cir2 from cir1) 81 bytes <{0}> >{0}< [rendered]
1404+
chunk {5} cir2 from cir1.js (cir2 from cir1) 81 bytes <{0}> [rendered]
14051405
> [2] ./circular1.js 1:0-79
14061406
> [2] ./circular1.js 1:0-79
14071407
[3] ./circular2.js 81 bytes {3} {5} [built]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import leftHelix from './leftHelix';
2+
import rightHelix from './rightHelix';
3+
4+
it("should import generate ensure function for this", () =>
5+
{
6+
return Promise.all([
7+
leftHelix.run(),
8+
rightHelix.run()
9+
]);
10+
});
11+
12+
export default {
13+
leftHelix,
14+
rightHelix,
15+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import leftHelixPrime, { run } from './leftHelixPrime';
2+
3+
export default {
4+
leftHelixPrime,
5+
run
6+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import rightHelixPrime from './rightHelixPrime';
2+
3+
export function run() {
4+
return import(/* webpackChunkName: "left" */ './leftHelix');
5+
}
6+
7+
export default {
8+
rightHelixPrime,
9+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import rightHelixPrime, { run } from './rightHelixPrime';
2+
3+
export default {
4+
rightHelixPrime,
5+
run
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import leftHelixPrime from './leftHelixPrime';
2+
3+
export function run() {
4+
return import(/* webpackChunkName: "right" */ './rightHelix');
5+
}
6+
7+
export default {
8+
leftHelixPrime
9+
};

0 commit comments

Comments
 (0)