File tree Expand file tree Collapse file tree 5 files changed +47
-5
lines changed
statsCases/runtime-chunk-issue-7382 Expand file tree Collapse file tree 5 files changed +47
-5
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,15 @@ module.exports = class RuntimeChunkPlugin {
1919 compilation . hooks . optimizeChunksAdvanced . tap ( "RuntimeChunkPlugin" , ( ) => {
2020 for ( const entrypoint of compilation . entrypoints . values ( ) ) {
2121 const chunk = entrypoint . getRuntimeChunk ( ) ;
22- if ( chunk . getNumberOfModules ( ) > 0 ) {
23- let name = this . options . name ;
24- if ( typeof name === "function" ) {
25- name = name ( entrypoint ) ;
26- }
22+ let name = this . options . name ;
23+ if ( typeof name === "function" ) {
24+ name = name ( entrypoint ) ;
25+ }
26+ if (
27+ chunk . getNumberOfModules ( ) > 0 ||
28+ ! chunk . preventIntegration ||
29+ chunk . name !== name
30+ ) {
2731 const newChunk = compilation . addChunk ( name ) ;
2832 newChunk . preventIntegration = true ;
2933 entrypoint . unshiftChunk ( newChunk ) ;
Original file line number Diff line number Diff line change @@ -1973,6 +1973,11 @@ Child manifest is named entry:
19731973 [4] ./f.js 20 bytes { 1 } [built]"
19741974` ;
19751975
1976+ exports [` StatsTestCases should print correct stats for runtime-chunk-issue-7382 1` ] = `
1977+ "Entrypoint e1 = runtime.js all.js e1.js
1978+ Entrypoint e2 = runtime.js all.js e2.js"
1979+ ` ;
1980+
19761981exports [` StatsTestCases should print correct stats for runtime-chunk-single 1` ] = `
19771982"Entrypoint e1 = runtime.js e1.js
19781983Entrypoint e2 = runtime.js e2.js"
Original file line number Diff line number Diff line change 1+ module . exports = "entry1" ;
Original file line number Diff line number Diff line change 1+ module . exports = "entry2" ;
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ mode : "development" ,
3+ entry : {
4+ e1 : "./e1" ,
5+ e2 : "./e2"
6+ } ,
7+ output : {
8+ filename : "[name].js"
9+ } ,
10+ stats : {
11+ hash : false ,
12+ timings : false ,
13+ builtAt : false ,
14+ assets : false ,
15+ modules : false ,
16+ reasons : true
17+ } ,
18+ optimization : {
19+ runtimeChunk : "single" ,
20+ splitChunks : {
21+ cacheGroups : {
22+ all : {
23+ test : / ./ ,
24+ name : "all" ,
25+ minSize : 0 ,
26+ chunks : "initial"
27+ }
28+ }
29+ }
30+ }
31+ } ;
You can’t perform that action at this time.
0 commit comments