File tree Expand file tree Collapse file tree 9 files changed +80
-0
lines changed
test/statsCases/runtime-chunk-integration Expand file tree Collapse file tree 9 files changed +80
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ class Chunk {
50
50
this . ids = null ;
51
51
this . debugId = debugId ++ ;
52
52
this . name = name ;
53
+ this . preventIntegration = false ;
53
54
this . entryModule = undefined ;
54
55
this . _modules = new SortableSet ( undefined , sortByIdentifier ) ;
55
56
this . _groups = new SortableSet ( undefined , sortById ) ;
@@ -265,6 +266,9 @@ class Chunk {
265
266
}
266
267
return true ;
267
268
} ;
269
+
270
+ if ( this . preventIntegration || otherChunk . preventIntegration ) return false ;
271
+
268
272
if ( this . hasRuntime ( ) !== otherChunk . hasRuntime ( ) ) {
269
273
if ( this . hasRuntime ( ) ) {
270
274
return isAvailable ( this , otherChunk ) ;
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ module.exports = class RuntimeChunkPlugin {
25
25
name = name ( entrypoint ) ;
26
26
}
27
27
const newChunk = compilation . addChunk ( name ) ;
28
+ newChunk . preventIntegration = true ;
28
29
entrypoint . unshiftChunk ( newChunk ) ;
29
30
newChunk . addGroup ( entrypoint ) ;
30
31
entrypoint . setRuntimeChunk ( newChunk ) ;
Original file line number Diff line number Diff line change
1
+ export default "b" ;
Original file line number Diff line number Diff line change
1
+ export default "c" ;
Original file line number Diff line number Diff line change
1
+ export default "d" ;
Original file line number Diff line number Diff line change
1
+ Child base:
2
+ Asset Size Chunks Chunk Names
3
+ 0.js 719 bytes 0 [emitted]
4
+ main1.js 542 bytes 1 [emitted] main1
5
+ runtime.js 7.73 KiB 2 [emitted] runtime
6
+ Entrypoint main1 = runtime.js main1.js
7
+ [0] ./b.js 20 bytes {0} [built]
8
+ [1] ./c.js 20 bytes {0} [built]
9
+ [2] ./d.js 20 bytes {0} [built]
10
+ [3] ./main1.js 66 bytes {1} [built]
11
+ Child manifest is named entry:
12
+ Asset Size Chunks Chunk Names
13
+ 0.js 719 bytes 0 [emitted]
14
+ manifest.js 8.04 KiB 1 [emitted] manifest
15
+ main1.js 542 bytes 2 [emitted] main1
16
+ Entrypoint main1 = manifest.js main1.js
17
+ Entrypoint manifest = manifest.js
18
+ [0] ./b.js 20 bytes {0} [built]
19
+ [1] ./c.js 20 bytes {0} [built]
20
+ [2] ./d.js 20 bytes {0} [built]
21
+ [3] ./main1.js 66 bytes {2} [built]
22
+ [4] ./f.js 20 bytes {1} [built]
Original file line number Diff line number Diff line change
1
+ export default "f" ;
Original file line number Diff line number Diff line change
1
+ import ( "./b" ) ;
2
+ import ( "./c" ) ;
3
+ import ( "./d" ) ;
4
+
5
+ export default "a" ;
Original file line number Diff line number Diff line change
1
+ const MinChunkSizePlugin = require ( "../../../lib/optimize/MinChunkSizePlugin" ) ;
2
+
3
+ const baseConfig = {
4
+ mode : "production" ,
5
+ target : "web" ,
6
+ output : {
7
+ filename : "[name].js"
8
+ } ,
9
+ stats : {
10
+ hash : false ,
11
+ timings : false ,
12
+ builtAt : false
13
+ } ,
14
+ plugins : [
15
+ new MinChunkSizePlugin ( {
16
+ minChunkSize : 1000
17
+ } )
18
+ ]
19
+ } ;
20
+
21
+ const withoutNamedEntry = Object . assign ( { } , baseConfig , {
22
+ name : "base" ,
23
+ entry : {
24
+ main1 : "./main1"
25
+ } ,
26
+ optimization : {
27
+ runtimeChunk : "single"
28
+ }
29
+ } ) ;
30
+
31
+ const withNamedEntry = Object . assign ( { } , baseConfig , {
32
+ name : "manifest is named entry" ,
33
+ entry : {
34
+ main1 : "./main1" ,
35
+ manifest : "./f"
36
+ } ,
37
+ optimization : {
38
+ runtimeChunk : {
39
+ name : "manifest"
40
+ }
41
+ }
42
+ } ) ;
43
+
44
+ module . exports = [ withoutNamedEntry , withNamedEntry ] ;
You can’t perform that action at this time.
0 commit comments