File tree Expand file tree Collapse file tree 11 files changed +83
-0
lines changed
named-chunks-plugin-async Expand file tree Collapse file tree 11 files changed +83
-0
lines changed Original file line number Diff line number Diff line change
1
+ import ( "./modules/a" ) ;
2
+ import ( "./modules/b" ) ;
3
+
Original file line number Diff line number Diff line change
1
+ Hash: ad8adb01e611de794006
2
+ Time: Xms
3
+ Asset Size Chunks Chunk Names
4
+ chunk-containing-__a_js.js 266 bytes chunk-containing-__a_js [emitted]
5
+ chunk-containing-__b_js.js 123 bytes chunk-containing-__b_js [emitted]
6
+ entry.js 5.93 kB entry [emitted] entry
7
+ chunk {chunk-containing-__a_js} chunk-containing-__a_js.js 37 bytes {entry} [rendered]
8
+ [2] (webpack)/test/statsCases/named-chunks-plugin-async/modules/a.js 37 bytes {chunk-containing-__a_js} [built]
9
+ chunk {chunk-containing-__b_js} chunk-containing-__b_js.js 22 bytes {chunk-containing-__a_js} {entry} [rendered]
10
+ [0] (webpack)/test/statsCases/named-chunks-plugin-async/modules/b.js 22 bytes {chunk-containing-__b_js} [built]
11
+ chunk {entry} entry.js (entry) 47 bytes [entry] [rendered]
12
+ [1] (webpack)/test/statsCases/named-chunks-plugin-async/entry.js 47 bytes {entry} [built]
Original file line number Diff line number Diff line change
1
+ import ( "./b" ) ;
2
+ module . exports = "a" ;
Original file line number Diff line number Diff line change
1
+ module . exports = "b" ;
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+
3
+ const NamedChunksPlugin = require ( "../../../lib/NamedChunksPlugin" ) ;
4
+ const RequestShortener = require ( "../../../lib/RequestShortener" ) ;
5
+
6
+ module . exports = {
7
+ entry : {
8
+ "entry" : "./entry" ,
9
+ } ,
10
+ plugins : [
11
+ new NamedChunksPlugin ( function ( chunk ) {
12
+ if ( chunk . name ) {
13
+ return chunk . name ;
14
+ }
15
+ const modulesToName = ( mods ) => mods . map ( ( mod ) => {
16
+ const rs = new RequestShortener ( mod . context ) ;
17
+ return rs . shorten ( mod . request ) . replace ( / [ . \/ \\ ] / g, "_" ) ;
18
+ } ) . join ( "-" ) ;
19
+
20
+ if ( chunk . modules . length > 0 ) {
21
+ return `chunk-containing-${ modulesToName ( chunk . modules ) } ` ;
22
+ }
23
+
24
+ return null ;
25
+ } ) ,
26
+ ]
27
+ } ;
Original file line number Diff line number Diff line change
1
+ require ( "./modules/a" ) ;
2
+ require ( "./modules/b" ) ;
3
+ require ( "./modules/c" ) ;
Original file line number Diff line number Diff line change
1
+ Hash: 94a45a9bbaecf6012107
2
+ Time: Xms
3
+ Asset Size Chunks Chunk Names
4
+ entry.js 356 bytes entry, manifest [emitted] entry
5
+ manifest.js 5.72 kB manifest [emitted] manifest
6
+ vendor.js 408 bytes vendor, manifest [emitted] vendor
7
+ chunk {entry} entry.js (entry) 94 bytes {vendor} [initial] [rendered]
8
+ [./entry.js] (webpack)/test/statsCases/named-chunks-plugin/entry.js 72 bytes {entry} [built]
9
+ [./modules/c.js] (webpack)/test/statsCases/named-chunks-plugin/modules/c.js 22 bytes {entry} [built]
10
+ chunk {manifest} manifest.js (manifest) 0 bytes [entry] [rendered]
11
+ chunk {vendor} vendor.js (vendor) 84 bytes {manifest} [initial] [rendered]
12
+ [./modules/a.js] (webpack)/test/statsCases/named-chunks-plugin/modules/a.js 22 bytes {vendor} [built]
13
+ [./modules/b.js] (webpack)/test/statsCases/named-chunks-plugin/modules/b.js 22 bytes {vendor} [built]
14
+ [0] multi ./modules/a ./modules/b 40 bytes {vendor} [built]
Original file line number Diff line number Diff line change
1
+ module . exports = "a" ;
Original file line number Diff line number Diff line change
1
+ module . exports = "b" ;
Original file line number Diff line number Diff line change
1
+ module . exports = "c" ;
You can’t perform that action at this time.
0 commit comments