Skip to content

Commit ba8c0cd

Browse files
committed
WIP12
1 parent fa4ffd7 commit ba8c0cd

File tree

39 files changed

+175
-201
lines changed

39 files changed

+175
-201
lines changed

lib/ChunkTemplate.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,10 @@ module.exports = class ChunkTemplate extends Tapable {
3232
const result = [];
3333

3434
let filenameTemplate;
35-
if(chunk.isInitial()) {
36-
if(chunk.filenameTemplate)
37-
filenameTemplate = chunk.filenameTemplate;
38-
else
39-
filenameTemplate = outputOptions.filename;
40-
} else {
35+
if(chunk.filenameTemplate)
36+
filenameTemplate = chunk.filenameTemplate;
37+
else
4138
filenameTemplate = outputOptions.chunkFilename;
42-
}
4339

4440
result.push({
4541
render: () => this.renderJavascript(chunk, moduleTemplates.javascript, dependencyTemplates),

lib/Compilation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ class Compilation extends Tapable {
755755
const name = preparedEntrypoint.name;
756756
const chunk = this.addChunk(name);
757757
const entrypoint = new Entrypoint(name);
758+
entrypoint.setRuntimeChunk(chunk);
758759
entrypoint.addOrigin(null, name, preparedEntrypoint.request);
759760
this.namedChunkGroups.set(name, entrypoint);
760761
this.entrypoints.set(name, entrypoint);

lib/MainTemplate.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,8 @@ module.exports = class MainTemplate extends Tapable {
219219
let filenameTemplate;
220220
if(chunk.filenameTemplate)
221221
filenameTemplate = chunk.filenameTemplate;
222-
else if(chunk.isInitial())
222+
else
223223
filenameTemplate = outputOptions.filename;
224-
else {
225-
filenameTemplate = outputOptions.chunkFilename;
226-
}
227224

228225
const useChunkHash = this.useChunkHash(chunk);
229226

lib/WebpackOptionsDefaulter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
7474
this.set("output.filename", "[name].js");
7575
this.set("output.chunkFilename", "make", options => {
7676
const filename = options.output.filename;
77+
if(typeof filename === "function") return filename;
7778
const hasName = filename.includes("[name]");
79+
const hasId = filename.includes("[id]");
7880
const hasChunkHash = filename.includes("[chunkhash]");
79-
// Anything with [chunkhash] is already fine
80-
if(hasChunkHash) return filename;
81-
// Replace [name] with [id] because it doesn't require a name map
82-
if(hasName) return filename.replace("[name]", "[id]");
83-
// Prefix "[id]." in front of the basename
81+
// Anything changing depending on chunk is fine
82+
if(hasChunkHash || hasName || hasId) return filename;
83+
// Elsewise prefix "[id]." in front of the basename to make it changing
8484
return filename.replace(/(^|\/)([^/]*(?:\?|$))/, "$1[id].$2");
8585
});
8686
this.set("output.webassemblyModuleFilename", "[modulehash].module.wasm");

lib/web/JsonpMainTemplatePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@ class JsonpMainTemplatePlugin {
241241
var globalObject = mainTemplate.outputOptions.globalObject;
242242
return Template.asString([
243243
`var jsonpArray = ${globalObject}[${JSON.stringify(jsonpFunction)}] = ${globalObject}[${JSON.stringify(jsonpFunction)}] || [];`,
244-
"var parentJsonpFunction = jsonpArray.push.bind(jsonpArray);",
245244
"jsonpArray.push = webpackJsonpCallback;",
246245
"jsonpArray = jsonpArray.slice();",
247246
"for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);",
247+
"var parentJsonpFunction = jsonpArray.push.bind(jsonpArray);",
248248
"",
249249
source
250250
]);

test/ConfigTestCases.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ describe("ConfigTestCases", () => {
5353
if(!options.output.path) options.output.path = outputDirectory;
5454
if(typeof options.output.pathinfo === "undefined") options.output.pathinfo = true;
5555
if(!options.output.filename) options.output.filename = "bundle" + idx + ".js";
56-
if(!options.output.chunkFilename) options.output.chunkFilename = "[id].bundle" + idx + ".js";
5756
});
5857
let testConfig = {
5958
findBundle: function(i, options) {

test/configCases/externals/externals-in-commons-chunk/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ it("should not move externals into the commons chunk", function() {
1414

1515
require("external");
1616
require("external2");
17+
require("./module");
1718
});

test/configCases/externals/externals-in-commons-chunk/module.js

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
require("external");
22
require("external3");
3+
require("./module");

test/statsCases/aggressive-splitting-entry/expected.txt

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1-
Hash: 1566b744ed340d06cf49678e9703c3f3ced98ba9
1+
Hash: e3da7f19fc8db8fea5d9e3da7f19fc8db8fea5d9
22
Child fitting:
3-
Hash: 1566b744ed340d06cf49
3+
Hash: e3da7f19fc8db8fea5d9
44
Time: Xms
55
Asset Size Chunks Chunk Names
66
706f97eb6a2b8fb1a17e.js 1.05 KiB 0 [emitted]
7-
f5168cbfe6af674e726f.js 2.42 KiB 4 [emitted]
8-
67ac2e482574407f55af.js 1.94 KiB 5 [emitted]
9-
3dba85a2ba126eb7164e.js 9.31 KiB 444 [emitted]
10-
Entrypoint main = 3dba85a2ba126eb7164e.js 67ac2e482574407f55af.js f5168cbfe6af674e726f.js
11-
chunk {0} 706f97eb6a2b8fb1a17e.js 916 bytes <{444}> <{5}> <{4}> [rendered]
7+
3e99eb0cb296524693dd.js 9.86 KiB 1 [emitted]
8+
4c485a9e1dc58eedfbd1.js 1.94 KiB 2 [emitted]
9+
337c857e3e34cc5ef72d.js 1.94 KiB 3 [emitted]
10+
Entrypoint main = 4c485a9e1dc58eedfbd1.js 337c857e3e34cc5ef72d.js 3e99eb0cb296524693dd.js
11+
chunk {0} 706f97eb6a2b8fb1a17e.js 916 bytes <{2}> <{3}> <{1}>
1212
> ./g [4] ./index.js 7:0-13
1313
[7] ./g.js 916 bytes {0} [built]
14-
chunk {4} f5168cbfe6af674e726f.js 1.87 KiB ={444}= ={5}= >{0}< [initial] [rendered]
14+
chunk {1} 3e99eb0cb296524693dd.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered]
1515
> ./index main
16-
[3] ./e.js 899 bytes {4} [built]
17-
[4] ./index.js 111 bytes {4} [built]
18-
[6] ./f.js 900 bytes {4} [built]
19-
chunk {5} 67ac2e482574407f55af.js 1.76 KiB ={444}= ={4}= >{0}< [initial] [rendered] [recorded] aggressive splitted
16+
[3] ./e.js 899 bytes {1} [built]
17+
[4] ./index.js 111 bytes {1} [built]
18+
[6] ./f.js 900 bytes {1} [built]
19+
chunk {2} 4c485a9e1dc58eedfbd1.js 1.76 KiB ={3}= ={1}= >{0}< [initial] [rendered] [recorded] aggressive splitted
2020
> ./index main
21-
[2] ./d.js 899 bytes {5} [built]
22-
[5] ./a.js 899 bytes {5} [built]
23-
chunk {444} 3dba85a2ba126eb7164e.js 1.76 KiB ={5}= ={4}= >{0}< [entry] [rendered] [recorded] aggressive splitted
21+
[0] ./b.js 899 bytes {2} [built]
22+
[5] ./a.js 899 bytes {2} [built]
23+
chunk {3} 337c857e3e34cc5ef72d.js 1.76 KiB ={2}= ={1}= >{0}< [initial] [rendered] [recorded] aggressive splitted
2424
> ./index main
25-
[0] ./b.js 899 bytes {444} [built]
26-
[1] ./c.js 899 bytes {444} [built]
25+
[1] ./c.js 899 bytes {3} [built]
26+
[2] ./d.js 899 bytes {3} [built]
2727
Child content-change:
28-
Hash: 678e9703c3f3ced98ba9
28+
Hash: e3da7f19fc8db8fea5d9
2929
Time: Xms
3030
Asset Size Chunks Chunk Names
3131
706f97eb6a2b8fb1a17e.js 1.05 KiB 0 [emitted]
32-
b61ba852cf1ac63d14d8.js 2.42 KiB 1 [emitted]
33-
7b454d941daf2560a567.js 9.31 KiB 2 [emitted]
32+
3e99eb0cb296524693dd.js 9.86 KiB 1 [emitted]
33+
4c485a9e1dc58eedfbd1.js 1.94 KiB 2 [emitted]
3434
337c857e3e34cc5ef72d.js 1.94 KiB 3 [emitted]
35-
Entrypoint main = 7b454d941daf2560a567.js 337c857e3e34cc5ef72d.js b61ba852cf1ac63d14d8.js
35+
Entrypoint main = 4c485a9e1dc58eedfbd1.js 337c857e3e34cc5ef72d.js 3e99eb0cb296524693dd.js
3636
chunk {0} 706f97eb6a2b8fb1a17e.js 916 bytes <{2}> <{3}> <{1}>
3737
> ./g [4] ./index.js 7:0-13
3838
[7] ./g.js 916 bytes {0} [built]
39-
chunk {1} b61ba852cf1ac63d14d8.js 1.87 KiB ={2}= ={3}= >{0}< [initial] [rendered]
39+
chunk {1} 3e99eb0cb296524693dd.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered]
4040
> ./index main
4141
[3] ./e.js 899 bytes {1} [built]
4242
[4] ./index.js 111 bytes {1} [built]
4343
[6] ./f.js 900 bytes {1} [built]
44-
chunk {2} 7b454d941daf2560a567.js 1.76 KiB ={3}= ={1}= >{0}< [entry] [rendered] [recorded] aggressive splitted
44+
chunk {2} 4c485a9e1dc58eedfbd1.js 1.76 KiB ={3}= ={1}= >{0}< [initial] [rendered] [recorded] aggressive splitted
4545
> ./index main
4646
[0] ./b.js 899 bytes {2} [built]
4747
[5] ./a.js 899 bytes {2} [built]

test/statsCases/async-commons-chunk-auto/expected.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -229,23 +229,23 @@ Child vendors1:
229229
chunk {7} vendors1/main.js (main) 45 bytes >{1}< >{0}< >{3}< >{4}< >{6}< >{5}< [entry] [rendered]
230230
> ./ main
231231
[8] ./index.js 45 bytes {7} [built]
232-
chunk {8} vendors1/a.js (a) 122 bytes ={12}= ={13}= ={15}= >{2}< [initial] [rendered]
232+
chunk {8} vendors1/a.js (a) 122 bytes ={12}= ={13}= ={15}= >{2}< [entry] [rendered]
233233
> ./a a
234234
[7] ./a.js + 1 modules 122 bytes {3} {8} [built]
235235
| ./a.js 87 bytes [built]
236236
| ./e.js 20 bytes [built]
237-
chunk {9} vendors1/b.js (b) 92 bytes ={12}= ={13}= ={14}= [initial] [rendered]
237+
chunk {9} vendors1/b.js (b) 92 bytes ={12}= ={13}= ={14}= [entry] [rendered]
238238
> ./b b
239239
[0] ./d.js 20 bytes {3} {4} {5} {9} {10} {15} [built]
240240
[5] ./b.js 72 bytes {4} {9} [built]
241-
chunk {10} vendors1/c.js (c) 92 bytes ={11}= ={13}= ={14}= [initial] [rendered]
241+
chunk {10} vendors1/c.js (c) 92 bytes ={11}= ={13}= ={14}= [entry] [rendered]
242242
> ./c c
243243
[0] ./d.js 20 bytes {3} {4} {5} {9} {10} {15} [built]
244244
[6] ./c.js 72 bytes {5} {10} [built]
245-
chunk {11} vendors1/11.js 20 bytes ={13}= ={14}= ={10}= [entry] [rendered] vendors chunk
245+
chunk {11} vendors1/11.js 20 bytes ={13}= ={14}= ={10}= [initial] [rendered] vendors chunk
246246
> ./c c
247247
[4] ./node_modules/z.js 20 bytes {6} {11} [built]
248-
chunk {12} vendors1/12.js 20 bytes ={13}= ={14}= ={9}= ={15}= ={8}= >{2}< [entry] [rendered] vendors chunk
248+
chunk {12} vendors1/12.js 20 bytes ={13}= ={14}= ={9}= ={15}= ={8}= >{2}< [initial] [rendered] vendors chunk
249249
> ./b b
250250
> ./a a
251251
[3] ./node_modules/y.js 20 bytes {1} {12} [built]
@@ -307,23 +307,23 @@ Child async-and-vendor:
307307
chunk {9} async-and-vendor/main.js (main) 45 bytes >{2}< >{0}< >{1}< >{5}< >{8}< >{4}< >{7}< >{6}< [entry] [rendered]
308308
> ./ main
309309
[8] ./index.js 45 bytes {9} [built]
310-
chunk {10} async-and-vendor/a.js (a) 142 bytes ={13}= ={14}= >{1}< >{3}< [initial] [rendered]
310+
chunk {10} async-and-vendor/a.js (a) 142 bytes ={13}= ={14}= >{1}< >{3}< [entry] [rendered]
311311
> ./a a
312312
[0] ./d.js 20 bytes {5} {6} {8} {10} {11} {12} [built]
313313
[7] ./a.js + 1 modules 122 bytes {4} {10} [built]
314314
| ./a.js 87 bytes [built]
315315
| ./e.js 20 bytes [built]
316-
chunk {11} async-and-vendor/b.js (b) 112 bytes ={13}= ={14}= [initial] [rendered]
316+
chunk {11} async-and-vendor/b.js (b) 112 bytes ={13}= ={14}= [entry] [rendered]
317317
> ./b b
318318
[0] ./d.js 20 bytes {5} {6} {8} {10} {11} {12} [built]
319319
[2] ./f.js 20 bytes {1} {11} {12} [built]
320320
[5] ./b.js 72 bytes {5} {11} [built]
321-
chunk {12} async-and-vendor/c.js (c) 112 bytes ={13}= ={14}= [initial] [rendered]
321+
chunk {12} async-and-vendor/c.js (c) 112 bytes ={13}= ={14}= [entry] [rendered]
322322
> ./c c
323323
[0] ./d.js 20 bytes {5} {6} {8} {10} {11} {12} [built]
324324
[2] ./f.js 20 bytes {1} {11} {12} [built]
325325
[6] ./c.js 72 bytes {6} {12} [built]
326-
chunk {13} async-and-vendor/vendors.js (vendors) 61 bytes ={14}= ={11}= ={10}= ={12}= >{1}< >{3}< [entry] [rendered] vendors chunk vendors
326+
chunk {13} async-and-vendor/vendors.js (vendors) 61 bytes ={14}= ={11}= ={10}= ={12}= >{1}< >{3}< [initial] [rendered] vendors chunk vendors
327327
> ./b b
328328
> ./a a
329329
> ./c c
@@ -381,23 +381,23 @@ Child all:
381381
chunk {9} all/main.js (main) 45 bytes >{2}< >{0}< >{1}< >{5}< >{8}< >{4}< >{7}< >{6}< [entry] [rendered]
382382
> ./ main
383383
[8] ./index.js 45 bytes {9} [built]
384-
chunk {10} all/a.js (a) 142 bytes ={13}= ={14}= >{1}< >{3}< [initial] [rendered]
384+
chunk {10} all/a.js (a) 142 bytes ={13}= ={14}= >{1}< >{3}< [entry] [rendered]
385385
> ./a a
386386
[0] ./d.js 20 bytes {5} {6} {8} {10} {11} {12} [built]
387387
[7] ./a.js + 1 modules 122 bytes {4} {10} [built]
388388
| ./a.js 87 bytes [built]
389389
| ./e.js 20 bytes [built]
390-
chunk {11} all/b.js (b) 112 bytes ={13}= ={14}= [initial] [rendered]
390+
chunk {11} all/b.js (b) 112 bytes ={13}= ={14}= [entry] [rendered]
391391
> ./b b
392392
[0] ./d.js 20 bytes {5} {6} {8} {10} {11} {12} [built]
393393
[2] ./f.js 20 bytes {1} {11} {12} [built]
394394
[5] ./b.js 72 bytes {5} {11} [built]
395-
chunk {12} all/c.js (c) 112 bytes ={13}= ={14}= [initial] [rendered]
395+
chunk {12} all/c.js (c) 112 bytes ={13}= ={14}= [entry] [rendered]
396396
> ./c c
397397
[0] ./d.js 20 bytes {5} {6} {8} {10} {11} {12} [built]
398398
[2] ./f.js 20 bytes {1} {11} {12} [built]
399399
[6] ./c.js 72 bytes {6} {12} [built]
400-
chunk {13} all/vendors.js (vendors) 40 bytes ={14}= ={11}= ={10}= ={12}= >{1}< >{3}< [entry] [rendered] vendors chunk vendors
400+
chunk {13} all/vendors.js (vendors) 40 bytes ={14}= ={11}= ={10}= ={12}= >{1}< >{3}< [initial] [rendered] vendors chunk vendors
401401
> ./b b
402402
> ./a a
403403
> ./c c

test/statsCases/color-disabled/expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hash: f7ca86184b3fb5047dd4
1+
Hash: 8a0ebb916aaf99067211
22
Time: Xms
33
Asset Size Chunks Chunk Names
44
main.js 4.06 KiB 0 [emitted] main

test/statsCases/color-enabled-custom/expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hash: <CLR=BOLD>f7ca86184b3fb5047dd4</CLR>
1+
Hash: <CLR=BOLD>8a0ebb916aaf99067211</CLR>
22
Time: <CLR=BOLD>X</CLR>ms
33
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22><CLR=BOLD>Chunk Names</CLR>
44
<CLR=32>main.js</CLR> 4.06 KiB <CLR=BOLD>0</CLR> <CLR=32>[emitted]</CLR> main

test/statsCases/color-enabled/expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hash: <CLR=BOLD>f7ca86184b3fb5047dd4</CLR>
1+
Hash: <CLR=BOLD>8a0ebb916aaf99067211</CLR>
22
Time: <CLR=BOLD>X</CLR>ms
33
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22><CLR=BOLD>Chunk Names</CLR>
44
<CLR=32,BOLD>main.js</CLR> 4.06 KiB <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR> main
Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
Hash: 96561e55e52ce5dd05d9
1+
Hash: 0ffa64fb9bd6d9e9dce0
22
Time: Xms
3-
Asset Size Chunks Chunk Names
4-
entry-1.js 81 bytes 0 [emitted] entry-1
5-
vendor-1.js 5.62 KiB 1 [emitted] vendor-1
3+
Asset Size Chunks Chunk Names
4+
entry-1.js 5.44 KiB 0 [emitted] entry-1
5+
vendor-1.js 314 bytes 1 [emitted] vendor-1
66
Entrypoint entry-1 = vendor-1.js entry-1.js
7-
Entrypoint vendor-1 = vendor-1.js
8-
[0] ./modules/a.js 22 bytes {1} [built]
9-
[1] ./modules/b.js 22 bytes {1} [built]
10-
[2] ./modules/c.js 22 bytes {1} [built]
11-
[3] ./modules/d.js 22 bytes {1} [built]
12-
[4] ./modules/e.js 22 bytes {1} [built]
13-
[5] ./modules/f.js 22 bytes {1} [built]
14-
[6] multi ./modules/a ./modules/b ./modules/c 52 bytes {1} [built]
15-
[7] ./entry-1.js 145 bytes {1} [built]
7+
[0] ./entry-1.js 145 bytes {0} [built]
8+
[1] ./modules/a.js 22 bytes {1} [built]
9+
[2] ./modules/b.js 22 bytes {1} [built]
10+
[3] ./modules/c.js 22 bytes {1} [built]
11+
[4] ./modules/d.js 22 bytes {0} [built]
12+
[5] ./modules/e.js 22 bytes {0} [built]
13+
[6] ./modules/f.js 22 bytes {0} [built]
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
var CommonsChunkPlugin = require("../../../lib/optimize/CommonsChunkPlugin");
21
module.exports = {
32
mode: "production",
43
entry: {
5-
"entry-1": "./entry-1",
6-
"vendor-1": ["./modules/a", "./modules/b", "./modules/c"],
4+
"entry-1": "./entry-1"
75
},
8-
plugins: [
9-
new CommonsChunkPlugin({
10-
name: "vendor-1",
11-
minChunks: 1,
12-
minSize: 0,
13-
}),
14-
]
6+
optimization: {
7+
initialVendorsChunks: {
8+
"vendor-1": /modules[\\/][abc]/
9+
}
10+
}
1511
};
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
Hash: bac598d1d2bd19d61b66
1+
Hash: 0ffa64fb9bd6d9e9dce0
22
Time: Xms
3-
Asset Size Chunks Chunk Names
4-
entry-1.js 3.22 KiB 0 [emitted] entry-1
5-
vendor-1.js 2.97 KiB 1 [emitted] vendor-1
6-
Entrypoint entry-1 = entry-1.js
7-
Entrypoint vendor-1 = vendor-1.js
8-
[0] ./modules/a.js 22 bytes {0} {1} [built]
9-
[1] ./modules/b.js 22 bytes {0} {1} [built]
10-
[2] ./modules/c.js 22 bytes {0} {1} [built]
11-
[3] ./entry-1.js 145 bytes {0} [built]
3+
Asset Size Chunks Chunk Names
4+
entry-1.js 5.44 KiB 0 [emitted] entry-1
5+
vendor-1.js 314 bytes 1 [emitted] vendor-1
6+
Entrypoint entry-1 = vendor-1.js entry-1.js
7+
[0] ./entry-1.js 145 bytes {0} [built]
8+
[1] ./modules/a.js 22 bytes {1} [built]
9+
[2] ./modules/b.js 22 bytes {1} [built]
10+
[3] ./modules/c.js 22 bytes {1} [built]
1211
[4] ./modules/d.js 22 bytes {0} [built]
1312
[5] ./modules/e.js 22 bytes {0} [built]
14-
[6] ./modules/f.js 22 bytes {0} [built]
15-
[7] multi ./modules/a ./modules/b ./modules/c 52 bytes {1} [built]
13+
[6] ./modules/f.js 22 bytes {0} [built]
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
var CommonsChunkPlugin = require("../../../lib/optimize/CommonsChunkPlugin");
21
module.exports = {
32
mode: "production",
43
entry: {
5-
"entry-1": "./entry-1",
6-
"vendor-1": ["./modules/a", "./modules/b", "./modules/c"],
4+
"entry-1": "./entry-1"
75
},
8-
plugins: [
9-
new CommonsChunkPlugin({
10-
name: "vendor-1",
11-
minChunks: 1,
12-
minSize: Infinity,
13-
}),
14-
]
6+
optimization: {
7+
initialVendorsChunks: {
8+
"vendor-1": /modules[\\/][abc]/
9+
}
10+
}
1511
};

test/statsCases/commons-plugin-issue-4980/expected.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
Hash: 0a7af1bf41c44dc4f3d62339087294aa36ac8856
1+
Hash: aa788836a27320e9e2c82a1426a570619ab0713a
22
Child
3-
Hash: 0a7af1bf41c44dc4f3d6
3+
Hash: aa788836a27320e9e2c8
44
Time: Xms
55
Asset Size Chunks Chunk Names
6-
app.js 656 bytes 0 [emitted] app
7-
vendor.1c0346d33a16fbee0579.js 619 bytes 1 [emitted] vendor
8-
runtime.js 4.65 KiB 2 [emitted] runtime
9-
Entrypoint app = runtime.js vendor.1c0346d33a16fbee0579.js app.js
6+
app.js 5.53 KiB 0 [emitted] app
7+
vendor.a86979cc789cd5f9d78f.js 619 bytes 1 [emitted] vendor
8+
Entrypoint app = vendor.a86979cc789cd5f9d78f.js app.js
109
[./constants.js] 87 bytes {1} [built]
1110
[./entry-1.js] ./entry-1.js + 2 modules 190 bytes {0} [built]
1211
| ./entry-1.js 67 bytes [built]
1312
| ./submodule-a.js 59 bytes [built]
1413
| ./submodule-b.js 59 bytes [built]
1514
Child
16-
Hash: 2339087294aa36ac8856
15+
Hash: 2a1426a570619ab0713a
1716
Time: Xms
1817
Asset Size Chunks Chunk Names
19-
app.js 673 bytes 0 [emitted] app
20-
vendor.1c0346d33a16fbee0579.js 619 bytes 1 [emitted] vendor
21-
runtime.js 4.65 KiB 2 [emitted] runtime
22-
Entrypoint app = runtime.js vendor.1c0346d33a16fbee0579.js app.js
18+
app.js 5.54 KiB 0 [emitted] app
19+
vendor.a86979cc789cd5f9d78f.js 619 bytes 1 [emitted] vendor
20+
Entrypoint app = vendor.a86979cc789cd5f9d78f.js app.js
2321
[./constants.js] 87 bytes {1} [built]
2422
[./entry-2.js] ./entry-2.js + 2 modules 197 bytes {0} [built]
2523
| ./entry-2.js 67 bytes [built]

0 commit comments

Comments
 (0)