From 7387c50c3a50d95756e6f92c36d2b0368e7adb56 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Sat, 22 Apr 2017 18:59:15 +0200 Subject: [PATCH 1/4] change jsonp function to jsonp array push --- lib/Chunk.js | 2 +- lib/Entrypoint.js | 32 +++++- lib/JsonpChunkTemplatePlugin.js | 10 +- lib/JsonpMainTemplatePlugin.js | 58 ++++++++--- lib/optimize/AggressiveSplittingPlugin.js | 16 ++- lib/optimize/CommonsChunkPlugin.js | 4 +- lib/optimize/MergeDuplicateChunksPlugin.js | 2 +- test/Compiler.test.js | 2 +- test/Stats.test.js | 2 +- .../aggressive-splitting-entry/expected.txt | 38 +++---- .../input-records.json | 14 +-- .../expected.txt | 99 ++++++++++--------- .../input-records.json | 81 +++++++-------- test/statsCases/chunks/expected.txt | 10 +- test/statsCases/color-disabled/expected.txt | 2 +- .../color-enabled-custom/expected.txt | 2 +- test/statsCases/color-enabled/expected.txt | 2 +- .../commons-chunk-min-size-0/expected.txt | 6 +- .../expected.txt | 2 +- .../commons-plugin-issue-4980/expected.txt | 18 ++-- test/statsCases/define-plugin/expected.txt | 6 +- .../exclude-with-loader/expected.txt | 2 +- test/statsCases/external/expected.txt | 2 +- test/statsCases/filter-warnings/expected.txt | 28 +++--- test/statsCases/import-weak/expected.txt | 8 +- .../limit-chunk-count-plugin/expected.txt | 28 +++--- .../max-modules-default/expected.txt | 2 +- test/statsCases/max-modules/expected.txt | 2 +- .../named-chunks-plugin-async/expected.txt | 8 +- .../named-chunks-plugin/expected.txt | 12 +-- test/statsCases/optimize-chunks/expected.txt | 18 ++-- .../performance-disabled/expected.txt | 6 +- .../statsCases/performance-error/expected.txt | 6 +- .../performance-no-hints/expected.txt | 6 +- test/statsCases/preset-detailed/expected.txt | 10 +- .../expected.txt | 6 +- .../preset-normal-performance/expected.txt | 6 +- test/statsCases/preset-normal/expected.txt | 10 +- test/statsCases/preset-verbose/expected.txt | 10 +- .../resolve-plugin-context/expected.txt | 2 +- .../reverse-sort-modules/expected.txt | 2 +- .../scope-hoisting-multi/expected.txt | 6 +- .../separate-css-bundle/expected.txt | 10 +- test/statsCases/simple-more-info/expected.txt | 2 +- test/statsCases/simple/expected.txt | 2 +- test/statsCases/tree-shaking/expected.txt | 2 +- .../statsCases/warnings-uglifyjs/expected.txt | 2 +- 47 files changed, 335 insertions(+), 271 deletions(-) diff --git a/lib/Chunk.js b/lib/Chunk.js index 41cac42cd..cc700fb73 100644 --- a/lib/Chunk.js +++ b/lib/Chunk.js @@ -63,7 +63,7 @@ class Chunk { hasRuntime() { if(this.entrypoints.length === 0) return false; - return this.entrypoints[0].chunks[0] === this; + return this.entrypoints[0].getRuntimeChunk() === this; } isInitial() { diff --git a/lib/Entrypoint.js b/lib/Entrypoint.js index 10a4f605c..91d078a0d 100644 --- a/lib/Entrypoint.js +++ b/lib/Entrypoint.js @@ -10,19 +10,39 @@ class Entrypoint { this.chunks = []; } + removeChunk(chunk) { + var idx = this.chunks.indexOf(chunk); + if(idx >= 0) this.chunks.splice(idx, 1); + idx = chunk.entrypoints.indexOf(this); + if(idx >= 0) chunk.entrypoints.splice(idx, 1); + } + unshiftChunk(chunk) { this.chunks.unshift(chunk); chunk.entrypoints.push(this); } insertChunk(chunk, before) { + const oldIdx = this.chunks.indexOf(chunk); const idx = this.chunks.indexOf(before); - if(idx >= 0) { - this.chunks.splice(idx, 0, chunk); - } else { + if(idx < 0) { throw new Error("before chunk not found"); } - chunk.entrypoints.push(this); + if(oldIdx >= 0 && oldIdx > idx) { + this.chunks.splice(oldIdx, 1); + this.chunks.splice(idx, 0, chunk); + } else if(oldIdx < 0) { + this.chunks.splice(idx, 0, chunk); + chunk.entrypoints.push(this); + } + } + + appendChunk(chunk) { + const idx = this.chunks.indexOf(chunk); + if(idx < 0) { + this.chunks.push(chunk); + chunk.entrypoints.push(this); + } } getFiles() { @@ -38,6 +58,10 @@ class Entrypoint { return files; } + + getRuntimeChunk() { + return this.chunks[0]; + } } module.exports = Entrypoint; diff --git a/lib/JsonpChunkTemplatePlugin.js b/lib/JsonpChunkTemplatePlugin.js index 5b427cfbd..af404c7f7 100644 --- a/lib/JsonpChunkTemplatePlugin.js +++ b/lib/JsonpChunkTemplatePlugin.js @@ -11,18 +11,20 @@ class JsonpChunkTemplatePlugin { chunkTemplate.plugin("render", function(modules, chunk) { const jsonpFunction = this.outputOptions.jsonpFunction; const source = new ConcatSource(); - source.add(`${jsonpFunction}(${JSON.stringify(chunk.ids)},`); + source.add(`(window[${JSON.stringify(jsonpFunction)}] = window[${JSON.stringify(jsonpFunction)}] || []).push([${JSON.stringify(chunk.ids)},`); source.add(modules); - const entries = [chunk.entryModule].filter(Boolean).map(m => m.id); + const entries = [chunk.entryModule] + .filter(Boolean) + .map(m => [chunk.entrypoints[0].chunks.map(c => c.id), m.id]); if(entries.length > 0) { source.add(`,${JSON.stringify(entries)}`); } - source.add(")"); + source.add("])"); return source; }); chunkTemplate.plugin("hash", function(hash) { hash.update("JsonpChunkTemplatePlugin"); - hash.update("3"); + hash.update("4"); hash.update(`${this.outputOptions.jsonpFunction}`); hash.update(`${this.outputOptions.library}`); }); diff --git a/lib/JsonpMainTemplatePlugin.js b/lib/JsonpMainTemplatePlugin.js index 5bcd5c572..0f4538406 100644 --- a/lib/JsonpMainTemplatePlugin.js +++ b/lib/JsonpMainTemplatePlugin.js @@ -9,8 +9,15 @@ const Template = require("./Template"); class JsonpMainTemplatePlugin { apply(mainTemplate) { + function needChunkLoadingCode(chunk) { + var otherChunksInEntry = chunk.entrypoints.some(function(entrypoint) { + return entrypoint.chunks.length > 1; + }); + var onDemandChunks = chunk.chunks.length > 0; + return otherChunksInEntry || onDemandChunks; + } mainTemplate.plugin("local-vars", function(source, chunk) { - if(chunk.chunks.length > 0) { + if(needChunkLoadingCode(chunk)) { return this.asString([ source, "", @@ -19,7 +26,9 @@ class JsonpMainTemplatePlugin { this.indent( chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(",\n") ), - "};" + "};", + "", + "var scheduledModules = [];" ]); } return source; @@ -120,15 +129,14 @@ class JsonpMainTemplatePlugin { ]); }); mainTemplate.plugin("bootstrap", function(source, chunk, hash) { - if(chunk.chunks.length > 0) { - var jsonpFunction = this.outputOptions.jsonpFunction; + if(needChunkLoadingCode(chunk)) { return this.asString([ source, "", "// install a JSONP callback for chunk loading", - `var parentJsonpFunction = window[${JSON.stringify(jsonpFunction)}];`, - `window[${JSON.stringify(jsonpFunction)}] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {`, + "function webpackJsonpCallback(data) {", this.indent([ + "var chunkIds = data[0], moreModules = data[1], executeModules = data[2];", "// add \"moreModules\" to the modules object,", "// then flag all \"chunkIds\" as loaded and fire callback", "var moduleId, chunkId, i = 0, resolves = [], result;", @@ -148,15 +156,28 @@ class JsonpMainTemplatePlugin { "}" ]), "}", - "if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);", + "if(parentJsonpFunction) parentJsonpFunction(data);", "while(resolves.length) {", this.indent("resolves.shift()();"), "}", this.entryPointInChildren(chunk) ? [ - "if(executeModules) {", + "scheduledModules.push.apply(scheduledModules, executeModules || []);", + "", + "for(i = 0; i < scheduledModules.length; i++) {", this.indent([ - "for(i=0; i < executeModules.length; i++) {", - this.indent(`result = ${this.requireFn}(${this.requireFn}.s = executeModules[i]);`), + "var scheduledModule = scheduledModules[i];", + "var fullfilled = true;", + "for(var j = 0; j < scheduledModule[0].length; j++) {", + this.indent([ + "var depId = scheduledModule[0][j];", + "if(installedChunks[depId] !== 0) fullfilled = false;" + ]), + "}", + "if(fullfilled) {", + this.indent([ + "scheduledModules.splice(i--, 1);", + "result = " + this.requireFn + "(" + this.requireFn + ".s = scheduledModule[1]);", + ]), "}" ]), "}", @@ -168,6 +189,21 @@ class JsonpMainTemplatePlugin { } return source; }); + mainTemplate.plugin("startup", function(source, chunk, hash) { + if(needChunkLoadingCode(chunk)) { + var jsonpFunction = this.outputOptions.jsonpFunction; + return this.asString([ + `var jsonpArray = window[${JSON.stringify(jsonpFunction)}] = window[${JSON.stringify(jsonpFunction)}] || [];`, + "var parentJsonpFunction = jsonpArray.push.bind(jsonpArray);", + "jsonpArray.push = webpackJsonpCallback;", + "jsonpArray = jsonpArray.slice();", + "for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);", + "", + source + ]); + } + return source; + }); mainTemplate.plugin("hot-bootstrap", function(source, chunk, hash) { const hotUpdateChunkFilename = this.outputOptions.hotUpdateChunkFilename; const hotUpdateMainFilename = this.outputOptions.hotUpdateMainFilename; @@ -198,7 +234,7 @@ this[${JSON.stringify(hotUpdateFunction)}] = ${runtimeSource}`; }); mainTemplate.plugin("hash", function(hash) { hash.update("jsonp"); - hash.update("4"); + hash.update("5"); hash.update(`${this.outputOptions.filename}`); hash.update(`${this.outputOptions.chunkFilename}`); hash.update(`${this.outputOptions.jsonpFunction}`); diff --git a/lib/optimize/AggressiveSplittingPlugin.js b/lib/optimize/AggressiveSplittingPlugin.js index bf286bc2d..be466d03a 100644 --- a/lib/optimize/AggressiveSplittingPlugin.js +++ b/lib/optimize/AggressiveSplittingPlugin.js @@ -153,6 +153,8 @@ class AggressiveSplittingPlugin { // 3. save to made splittings to records const minSize = this.options.minSize; if(!records.aggressiveSplits) records.aggressiveSplits = []; + const newSplits = []; + let splittingInvalid = false; compilation.chunks.forEach((chunk) => { if(chunk.hasEntryModule()) return; const size = chunk.size(this.options); @@ -160,8 +162,9 @@ class AggressiveSplittingPlugin { const modules = chunk.mapModules(m => identifierUtils.makePathsRelative(compiler.context, m.identifier(), compilation.cache)); if(typeof chunk._fromAggressiveSplittingIndex === "undefined") { if(incorrectSize) return; + // this is a new chunk splitting, we record it so we reuse it next time chunk.recorded = true; - records.aggressiveSplits.push({ + newSplits.push({ modules: modules, hash: chunk.hash, id: chunk.id @@ -172,15 +175,20 @@ class AggressiveSplittingPlugin { if(chunk._fromAggressiveSplitting) { chunk._aggressiveSplittingInvalid = true; splitData.invalid = true; + splittingInvalid = true; } else { splitData.hash = chunk.hash; } } } }); - records.aggressiveSplits = records.aggressiveSplits.filter((splitData) => { - return !splitData.invalid; - }); + if(splittingInvalid) { + records.aggressiveSplits = records.aggressiveSplits.filter((splitData) => { + return !splitData.invalid; + }); + } else { + records.aggressiveSplits = records.aggressiveSplits.concat(newSplits); + } }); compilation.plugin("need-additional-seal", (callback) => { const invalid = compilation.chunks.some((chunk) => { diff --git a/lib/optimize/CommonsChunkPlugin.js b/lib/optimize/CommonsChunkPlugin.js index bd034f903..e0980e02d 100644 --- a/lib/optimize/CommonsChunkPlugin.js +++ b/lib/optimize/CommonsChunkPlugin.js @@ -262,7 +262,7 @@ Take a look at the "name"/"names" or async/children option.`); return allChunks.filter((chunk) => { const found = targetChunks.indexOf(chunk); if(found >= currentIndex) return false; - return chunk.hasRuntime(); + return chunk.isInitial(); }); } @@ -349,7 +349,7 @@ Take a look at the "name"/"names" or async/children option.`); // add chunk to commonChunk commonChunk.addChunk(chunk); - for(const entrypoint of chunk.entrypoints) { + for(const entrypoint of chunk.entrypoints.slice()) { entrypoint.insertChunk(commonChunk, chunk); } } diff --git a/lib/optimize/MergeDuplicateChunksPlugin.js b/lib/optimize/MergeDuplicateChunksPlugin.js index a37ab3c2e..77be38635 100644 --- a/lib/optimize/MergeDuplicateChunksPlugin.js +++ b/lib/optimize/MergeDuplicateChunksPlugin.js @@ -11,7 +11,7 @@ class MergeDuplicateChunksPlugin { compilation.plugin("optimize-chunks-basic", (chunks) => { const map = Object.create(null); chunks.slice().forEach((chunk) => { - if(chunk.hasRuntime() || chunk.hasEntryModule()) return; + if(chunk.hasEntryModule()) return; const ident = chunk.getModulesIdent(); const otherChunk = map[ident]; if(otherChunk) { diff --git a/test/Compiler.test.js b/test/Compiler.test.js index 8a0e3c53e..4fda03c64 100644 --- a/test/Compiler.test.js +++ b/test/Compiler.test.js @@ -161,7 +161,7 @@ describe("Compiler", () => { bundle.should.not.containEql("fixtures"); chunk.should.not.containEql("fixtures"); bundle.should.containEql("webpackJsonp"); - chunk.should.containEql("webpackJsonp("); + chunk.should.containEql("window[\"webpackJsonp\"] || []).push"); done(); }); }); diff --git a/test/Stats.test.js b/test/Stats.test.js index c49ab7930..980677f0b 100644 --- a/test/Stats.test.js +++ b/test/Stats.test.js @@ -180,4 +180,4 @@ describe("Stats", () => { }); }); }); -}); +}, 10000); diff --git a/test/statsCases/aggressive-splitting-entry/expected.txt b/test/statsCases/aggressive-splitting-entry/expected.txt index fff900916..6c07820ae 100644 --- a/test/statsCases/aggressive-splitting-entry/expected.txt +++ b/test/statsCases/aggressive-splitting-entry/expected.txt @@ -1,24 +1,24 @@ -Hash: c4756fe25e35ccb187f7 +Hash: c55fcf171c46cbd1e5a1 Time: Xms - Asset Size Chunks Chunk Names -48c8b1dae03a37363ec8.js 4.2 kB 1 [emitted] -002fc3bb6fc14459f8e8.js 2.23 kB 2 [emitted] -9356e9a0fb00a97b2e73.js 1.94 kB 3 [emitted] -88d78642a86768757078.js 979 bytes 4 [emitted] -Entrypoint main = 48c8b1dae03a37363ec8.js 9356e9a0fb00a97b2e73.js 88d78642a86768757078.js 002fc3bb6fc14459f8e8.js -chunk {1} 48c8b1dae03a37363ec8.js 1.8 kB [entry] [rendered] + Asset Size Chunks Chunk Names +9748a8a04a5102209105.js 2.29 kB 1 [emitted] +79e8b67b4f31cdb0299f.js 1.99 kB 2 [emitted] +628e75ea29b4a779b369.js 1.03 kB 3 [emitted] +dd43a4ed55c20668ec9b.js 5.72 kB 444 [emitted] +Entrypoint main = dd43a4ed55c20668ec9b.js 79e8b67b4f31cdb0299f.js 628e75ea29b4a779b369.js 9748a8a04a5102209105.js +chunk {1} 9748a8a04a5102209105.js 1.91 kB [initial] [rendered] > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js - [0] (webpack)/test/statsCases/aggressive-splitting-entry/b.js 899 bytes {1} [built] - [1] (webpack)/test/statsCases/aggressive-splitting-entry/c.js 899 bytes {1} [built] -chunk {2} 002fc3bb6fc14459f8e8.js 1.91 kB [initial] [rendered] + [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js 112 bytes {1} [built] + [6] (webpack)/test/statsCases/aggressive-splitting-entry/f.js 899 bytes {1} [built] + [7] (webpack)/test/statsCases/aggressive-splitting-entry/g.js 899 bytes {1} [built] +chunk {2} 79e8b67b4f31cdb0299f.js 1.8 kB [initial] [rendered] [recorded] > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js - [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js 112 bytes {2} [built] - [6] (webpack)/test/statsCases/aggressive-splitting-entry/f.js 899 bytes {2} [built] - [7] (webpack)/test/statsCases/aggressive-splitting-entry/g.js 899 bytes {2} [built] -chunk {3} 9356e9a0fb00a97b2e73.js 1.8 kB [initial] [rendered] [recorded] + [2] (webpack)/test/statsCases/aggressive-splitting-entry/d.js 899 bytes {2} [built] + [5] (webpack)/test/statsCases/aggressive-splitting-entry/a.js 899 bytes {2} [built] +chunk {3} 628e75ea29b4a779b369.js 899 bytes [initial] [rendered] > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js - [2] (webpack)/test/statsCases/aggressive-splitting-entry/d.js 899 bytes {3} [built] - [5] (webpack)/test/statsCases/aggressive-splitting-entry/a.js 899 bytes {3} [built] -chunk {4} 88d78642a86768757078.js 899 bytes [initial] [rendered] + [3] (webpack)/test/statsCases/aggressive-splitting-entry/e.js 899 bytes {3} [built] +chunk {444} dd43a4ed55c20668ec9b.js 1.8 kB [entry] [rendered] > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js - [3] (webpack)/test/statsCases/aggressive-splitting-entry/e.js 899 bytes {4} [built] \ No newline at end of file + [0] (webpack)/test/statsCases/aggressive-splitting-entry/b.js 899 bytes {444} [built] + [1] (webpack)/test/statsCases/aggressive-splitting-entry/c.js 899 bytes {444} [built] \ No newline at end of file diff --git a/test/statsCases/aggressive-splitting-entry/input-records.json b/test/statsCases/aggressive-splitting-entry/input-records.json index 72b64a7f8..17d35da29 100644 --- a/test/statsCases/aggressive-splitting-entry/input-records.json +++ b/test/statsCases/aggressive-splitting-entry/input-records.json @@ -5,14 +5,16 @@ "c.js": 1, "d.js": 2, "e.js": 3, - "index.js": 4 + "index.js": 4, + "a.js": 5 }, "usedIds": { "0": 0, "1": 1, "2": 2, "3": 3, - "4": 4 + "4": 4, + "5": 5 } }, "chunks": { @@ -20,7 +22,7 @@ "byBlocks": {}, "usedIds": { "0": 0, - "1": 1 + "444": 444 } }, "aggressiveSplits": [ @@ -29,8 +31,8 @@ "b.js", "c.js" ], - "hash": "48c8b1dae03a37363ec82be4f7b781bc", - "id": 1 + "hash": "dd43a4ed55c20668ec9be140e41d560b", + "id": 444 } ] -} \ No newline at end of file +} diff --git a/test/statsCases/aggressive-splitting-on-demand/expected.txt b/test/statsCases/aggressive-splitting-on-demand/expected.txt index c37ff156d..1784b57fa 100644 --- a/test/statsCases/aggressive-splitting-on-demand/expected.txt +++ b/test/statsCases/aggressive-splitting-on-demand/expected.txt @@ -1,49 +1,52 @@ -Hash: 3605a628ea012f7d12ca +Hash: e5b1b675c694b995a779 Time: Xms - Asset Size Chunks Chunk Names -fc930a2adf8206ea2dc5.js 1.94 kB 0 [emitted] -cd45585186d59208602b.js 1.96 kB 1 [emitted] -6b94c231e016c5aaccdb.js 1.94 kB 2 [emitted] -fd0985cee894c4f3f1a6.js 1.94 kB 3 [emitted] -d9fc46873c8ea924b895.js 979 bytes 4 [emitted] -a773fee259e5a284dea9.js 7.47 kB 6 [emitted] main -b08c507d4e1e05cbab45.js 985 bytes 9 [emitted] -5d50e858fe6e559aa47c.js 977 bytes 11 [emitted] -Entrypoint main = a773fee259e5a284dea9.js -chunk {0} fc930a2adf8206ea2dc5.js 1.8 kB {6} - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 4:0-51 - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 5:0-44 - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 6:0-72 - [5] (webpack)/test/statsCases/aggressive-splitting-on-demand/f.js 899 bytes {0} [built] - [6] (webpack)/test/statsCases/aggressive-splitting-on-demand/g.js 901 bytes {0} [built] -chunk {1} cd45585186d59208602b.js 1.8 kB {6} [recorded] - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 3:0-30 - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 5:0-44 - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 6:0-72 - [3] (webpack)/test/statsCases/aggressive-splitting-on-demand/d.js 899 bytes {1} [built] - [4] (webpack)/test/statsCases/aggressive-splitting-on-demand/e.js 899 bytes {1} [built] -chunk {2} 6b94c231e016c5aaccdb.js 1.8 kB {6} - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 4:0-51 - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 6:0-72 - [10] (webpack)/test/statsCases/aggressive-splitting-on-demand/j.js 901 bytes {2} [built] - [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/k.js 899 bytes {2} [built] -chunk {3} fd0985cee894c4f3f1a6.js 1.8 kB {6} [recorded] - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 4:0-51 - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 6:0-72 - [7] (webpack)/test/statsCases/aggressive-splitting-on-demand/h.js 899 bytes {3} [built] - [8] (webpack)/test/statsCases/aggressive-splitting-on-demand/i.js 899 bytes {3} [built] -chunk {4} d9fc46873c8ea924b895.js 899 bytes {6} - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 2:0-23 - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 3:0-30 - [2] (webpack)/test/statsCases/aggressive-splitting-on-demand/c.js 899 bytes {4} [built] -chunk {6} a773fee259e5a284dea9.js (main) 248 bytes [entry] - > main [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js - [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 248 bytes {6} [built] -chunk {9} b08c507d4e1e05cbab45.js 899 bytes {6} - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 2:0-23 - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 5:0-44 - > aggressive-splitted duplicate [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 6:0-72 - [1] (webpack)/test/statsCases/aggressive-splitting-on-demand/b.js 899 bytes {9} [built] -chunk {11} 5d50e858fe6e559aa47c.js 899 bytes {6} - > [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 1:0-16 - [0] (webpack)/test/statsCases/aggressive-splitting-on-demand/a.js 899 bytes {11} [built] \ No newline at end of file + Asset Size Chunks Chunk Names +c659704b2f31cae80013.js 2.01 kB 0 [emitted] +a0bf69daa522fbf8540c.js 1.03 kB 0 [emitted] +9799e4f21dc14d39e2fe.js 1.99 kB 1 [emitted] +7067a3cecd9faa0aea36.js 1.99 kB 3 [emitted] +ffed75a7125f4bffaa65.js 1.99 kB 4 [emitted] +1eb486d42a31b58c16de.js 1.03 kB 5 [emitted] +c0be493fc1372241e789.js 1.03 kB 6 [emitted] +b377816b50b5f53bb16f.js 7.75 kB 7 [emitted] main +abfb187b6140d9d3505a.js 1.99 kB 8, 0, 5 [emitted] +Entrypoint main = b377816b50b5f53bb16f.js +chunk {0} c659704b2f31cae80013.js 1.8 kB {7} [rendered] + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 4:0-51 + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 5:0-44 + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 6:0-72 + [3] (webpack)/test/statsCases/aggressive-splitting-on-demand/f.js 899 bytes {0} [built] + [4] (webpack)/test/statsCases/aggressive-splitting-on-demand/g.js 901 bytes {0} [built] +chunk {0} a0bf69daa522fbf8540c.js 899 bytes {7} [rendered] + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 5:0-44 + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 6:0-72 + [0] (webpack)/test/statsCases/aggressive-splitting-on-demand/b.js 899 bytes {0} {8} [built] +chunk {1} 9799e4f21dc14d39e2fe.js 1.8 kB {7} [rendered] + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 3:0-30 + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 5:0-44 + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 6:0-72 + [1] (webpack)/test/statsCases/aggressive-splitting-on-demand/d.js 899 bytes {1} [built] + [2] (webpack)/test/statsCases/aggressive-splitting-on-demand/e.js 899 bytes {1} [built] +chunk {3} 7067a3cecd9faa0aea36.js 1.8 kB {7} [rendered] + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 4:0-51 + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 6:0-72 + [8] (webpack)/test/statsCases/aggressive-splitting-on-demand/j.js 901 bytes {3} [built] + [9] (webpack)/test/statsCases/aggressive-splitting-on-demand/k.js 899 bytes {3} [built] +chunk {4} ffed75a7125f4bffaa65.js 1.8 kB {7} [rendered] + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 4:0-51 + > aggressive-splitted duplicate [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 6:0-72 + [6] (webpack)/test/statsCases/aggressive-splitting-on-demand/h.js 899 bytes {4} [built] + [7] (webpack)/test/statsCases/aggressive-splitting-on-demand/i.js 899 bytes {4} [built] +chunk {5} 1eb486d42a31b58c16de.js 899 bytes {7} [rendered] + > aggressive-splitted [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 3:0-30 + [5] (webpack)/test/statsCases/aggressive-splitting-on-demand/c.js 899 bytes {5} {8} [built] +chunk {6} c0be493fc1372241e789.js 899 bytes {7} [rendered] + > [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 1:0-16 + [10] (webpack)/test/statsCases/aggressive-splitting-on-demand/a.js 899 bytes {6} [built] +chunk {7} b377816b50b5f53bb16f.js (main) 248 bytes [entry] [rendered] + > main [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js + [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 248 bytes {7} [built] +chunk {8} abfb187b6140d9d3505a.js 1.8 kB {7} [rendered] [recorded] + > [11] (webpack)/test/statsCases/aggressive-splitting-on-demand/index.js 2:0-23 + [0] (webpack)/test/statsCases/aggressive-splitting-on-demand/b.js 899 bytes {0} {8} [built] + [5] (webpack)/test/statsCases/aggressive-splitting-on-demand/c.js 899 bytes {5} {8} [built] \ No newline at end of file diff --git a/test/statsCases/aggressive-splitting-on-demand/input-records.json b/test/statsCases/aggressive-splitting-on-demand/input-records.json index 712433093..9e9591280 100644 --- a/test/statsCases/aggressive-splitting-on-demand/input-records.json +++ b/test/statsCases/aggressive-splitting-on-demand/input-records.json @@ -1,18 +1,18 @@ { "modules": { "byIdentifier": { - "a.js": 0, - "b.js": 1, - "c.js": 2, - "d.js": 3, - "e.js": 4, - "f.js": 5, - "g.js": 6, - "h.js": 7, - "i.js": 8, - "index.js": 9, - "j.js": 10, - "k.js": 11 + "b.js": 0, + "d.js": 1, + "e.js": 2, + "f.js": 3, + "g.js": 4, + "c.js": 5, + "h.js": 6, + "i.js": 7, + "j.js": 8, + "k.js": 9, + "a.js": 10, + "index.js": 11 }, "usedIds": { "0": 0, @@ -31,19 +31,25 @@ }, "chunks": { "byName": { - "main": 6 + "main": 7 }, "byBlocks": { - "index.js:4/4:2": 0, - "index.js:3/4:0": 0, - "index.js:2/4:1": 1, - "index.js:4/4:1": 1, - "index.js:3/4:2": 2, - "index.js:3/4:1": 3, - "index.js:1/4": 4, - "index.js:4/4:0": 5, - "index.js:2/4:0": 7, - "index.js:0/4": 8 + "index.js:3/5:0": 0, + "index.js:4/5:2": 0, + "index.js:5/5:2": 0, + "index.js:2/5:0": 1, + "index.js:4/5:1": 1, + "index.js:5/5:1": 1, + "index.js:1/5:0": 2, + "index.js:4/5:0": 2, + "index.js:5/5:0": 2, + "index.js:3/5:2": 3, + "index.js:5/5:4": 3, + "index.js:3/5:1": 4, + "index.js:5/5:3": 4, + "index.js:2/5:1": 5, + "index.js:1/5:1": 5, + "index.js:0/5": 6 }, "usedIds": { "0": 0, @@ -53,8 +59,7 @@ "4": 4, "5": 5, "6": 6, - "7": 7, - "8": 8 + "7": 7 } }, "aggressiveSplits": [ @@ -63,7 +68,7 @@ "f.js", "g.js" ], - "hash": "7305696cca6d0d86929132c69380763f", + "hash": "c659704b2f31cae80013194b956d16ba", "id": 0 }, { @@ -71,7 +76,7 @@ "d.js", "e.js" ], - "hash": "11324f155de813ceb6584bbb3820bce4", + "hash": "9799e4f21dc14d39e2fe3e51c13dd5a6", "id": 1 }, { @@ -79,32 +84,16 @@ "j.js", "k.js" ], - "hash": "f829c6691cc38a359481f2a5ca94a222", - "id": 2 + "hash": "7067a3cecd9faa0aea363a87183b6d93", + "id": 3 }, { "modules": [ "h.js", "i.js" ], - "hash": "e91ec4902ca3057b42bb3d87c855733c", - "id": 3 - }, - { - "modules": [ - "b.js", - "c.js" - ], - "hash": "678b5386af25333c26261e48622f4864", + "hash": "ffed75a7125f4bffaa65bced2b62fc6c", "id": 4 - }, - { - "modules": [ - "a.js", - "b.js" - ], - "hash": "2a1056b05b68590f7fad418ec0619c8d", - "id": 5 } ] } \ No newline at end of file diff --git a/test/statsCases/chunks/expected.txt b/test/statsCases/chunks/expected.txt index 4d539f6d9..6092bda45 100644 --- a/test/statsCases/chunks/expected.txt +++ b/test/statsCases/chunks/expected.txt @@ -1,10 +1,10 @@ -Hash: 458904e7e19c8ce28066 +Hash: ec7c8a9a312ffc028d3e Time: Xms Asset Size Chunks Chunk Names -0.bundle.js 238 bytes 0 [emitted] -1.bundle.js 102 bytes 1 [emitted] -2.bundle.js 182 bytes 2 [emitted] - bundle.js 6.1 kB 3 [emitted] main +0.bundle.js 288 bytes 0 [emitted] +1.bundle.js 152 bytes 1 [emitted] +2.bundle.js 232 bytes 2 [emitted] + bundle.js 6.43 kB 3 [emitted] main chunk {0} 0.bundle.js 54 bytes {3} [rendered] > [0] (webpack)/test/statsCases/chunks/index.js 3:0-16 [3] (webpack)/test/statsCases/chunks/c.js 54 bytes {0} [built] diff --git a/test/statsCases/color-disabled/expected.txt b/test/statsCases/color-disabled/expected.txt index 9e18644ea..6a593f13e 100644 --- a/test/statsCases/color-disabled/expected.txt +++ b/test/statsCases/color-disabled/expected.txt @@ -1,4 +1,4 @@ -Hash: 6c781fe6bf412ba6435b +Hash: 24aac88a5fb0e1ef1a69 Time: Xms Asset Size Chunks Chunk Names main.js 2.47 kB 0 [emitted] main diff --git a/test/statsCases/color-enabled-custom/expected.txt b/test/statsCases/color-enabled-custom/expected.txt index f14fd735e..106da54f4 100644 --- a/test/statsCases/color-enabled-custom/expected.txt +++ b/test/statsCases/color-enabled-custom/expected.txt @@ -1,4 +1,4 @@ -Hash: 6c781fe6bf412ba6435b +Hash: 24aac88a5fb0e1ef1a69 Time: Xms Asset Size Chunks Chunk Names main.js 2.47 kB 0 [emitted] main diff --git a/test/statsCases/color-enabled/expected.txt b/test/statsCases/color-enabled/expected.txt index a9ee8d254..db808e119 100644 --- a/test/statsCases/color-enabled/expected.txt +++ b/test/statsCases/color-enabled/expected.txt @@ -1,4 +1,4 @@ -Hash: 6c781fe6bf412ba6435b +Hash: 24aac88a5fb0e1ef1a69 Time: Xms Asset Size Chunks Chunk Names main.js 2.47 kB 0 [emitted] main diff --git a/test/statsCases/commons-chunk-min-size-0/expected.txt b/test/statsCases/commons-chunk-min-size-0/expected.txt index 0673e9ea2..82c8f4b98 100644 --- a/test/statsCases/commons-chunk-min-size-0/expected.txt +++ b/test/statsCases/commons-chunk-min-size-0/expected.txt @@ -1,8 +1,8 @@ -Hash: dc6038bec87a57d1a45e +Hash: e2982ecf41bd0a7eda73 Time: Xms Asset Size Chunks Chunk Names - entry-1.js 25 bytes 0 [emitted] entry-1 -vendor-1.js 6.76 kB 1 [emitted] vendor-1 + entry-1.js 83 bytes 0 [emitted] entry-1 +vendor-1.js 7.51 kB 1 [emitted] vendor-1 [0] (webpack)/test/statsCases/commons-chunk-min-size-0/modules/a.js 22 bytes {1} [built] [1] (webpack)/test/statsCases/commons-chunk-min-size-0/modules/b.js 22 bytes {1} [built] [2] (webpack)/test/statsCases/commons-chunk-min-size-0/modules/c.js 22 bytes {1} [built] diff --git a/test/statsCases/commons-chunk-min-size-Infinity/expected.txt b/test/statsCases/commons-chunk-min-size-Infinity/expected.txt index 604973f76..8b7f87dfe 100644 --- a/test/statsCases/commons-chunk-min-size-Infinity/expected.txt +++ b/test/statsCases/commons-chunk-min-size-Infinity/expected.txt @@ -1,4 +1,4 @@ -Hash: 9c0d5be5c7febb314e7a +Hash: ff75deffb3bf6cded619 Time: Xms Asset Size Chunks Chunk Names entry-1.js 3.11 kB 0 [emitted] entry-1 diff --git a/test/statsCases/commons-plugin-issue-4980/expected.txt b/test/statsCases/commons-plugin-issue-4980/expected.txt index 36d2ebbe8..e14f21702 100644 --- a/test/statsCases/commons-plugin-issue-4980/expected.txt +++ b/test/statsCases/commons-plugin-issue-4980/expected.txt @@ -1,22 +1,22 @@ -Hash: 7d3a56317b2e339b1d822897fe6052020598632c +Hash: 7c4ddb2a33b188a6dd518c9d9930255682d3acb8 Child - Hash: 7d3a56317b2e339b1d82 + Hash: 7c4ddb2a33b188a6dd51 Time: Xms Asset Size Chunks Chunk Names - app.js 1.27 kB 0 [emitted] app - vendor.bd2b4219dfda1a951495.js 443 bytes 1 [emitted] vendor - runtime.js 5.78 kB 2 [emitted] runtime + app.js 1.33 kB 0 [emitted] app + vendor.76e65ef421e93d510398.js 493 bytes 1 [emitted] vendor + runtime.js 6.52 kB 2 [emitted] runtime [./constants.js] (webpack)/test/statsCases/commons-plugin-issue-4980/constants.js 87 bytes {1} [built] [./entry-1.js] (webpack)/test/statsCases/commons-plugin-issue-4980/entry-1.js 67 bytes {0} [built] [./submodule-a.js] (webpack)/test/statsCases/commons-plugin-issue-4980/submodule-a.js 59 bytes {0} [built] [./submodule-b.js] (webpack)/test/statsCases/commons-plugin-issue-4980/submodule-b.js 59 bytes {0} [built] Child - Hash: 2897fe6052020598632c + Hash: 8c9d9930255682d3acb8 Time: Xms Asset Size Chunks Chunk Names - app.js 1.32 kB 0 [emitted] app - vendor.bd2b4219dfda1a951495.js 443 bytes 1 [emitted] vendor - runtime.js 5.78 kB 2 [emitted] runtime + app.js 1.38 kB 0 [emitted] app + vendor.76e65ef421e93d510398.js 493 bytes 1 [emitted] vendor + runtime.js 6.52 kB 2 [emitted] runtime [./constants.js] (webpack)/test/statsCases/commons-plugin-issue-4980/constants.js 87 bytes {1} [built] [./entry-2.js] (webpack)/test/statsCases/commons-plugin-issue-4980/entry-2.js 67 bytes {0} [built] [./submodule-a.js] (webpack)/test/statsCases/commons-plugin-issue-4980/submodule-a.js 59 bytes {0} [built] diff --git a/test/statsCases/define-plugin/expected.txt b/test/statsCases/define-plugin/expected.txt index bc25d5d7a..332adc95c 100644 --- a/test/statsCases/define-plugin/expected.txt +++ b/test/statsCases/define-plugin/expected.txt @@ -1,12 +1,12 @@ -Hash: 052d0451a89cb963e4d3eb3ff8e5a88b9234d04f +Hash: 6add27cebf4b26789967542792bed75071de6d48 Child - Hash: 052d0451a89cb963e4d3 + Hash: 6add27cebf4b26789967 Time: Xms Asset Size Chunks Chunk Names main.js 2.52 kB 0 [emitted] main [0] (webpack)/test/statsCases/define-plugin/index.js 24 bytes {0} [built] Child - Hash: eb3ff8e5a88b9234d04f + Hash: 542792bed75071de6d48 Time: Xms Asset Size Chunks Chunk Names main.js 2.52 kB 0 [emitted] main diff --git a/test/statsCases/exclude-with-loader/expected.txt b/test/statsCases/exclude-with-loader/expected.txt index ac9ade187..937beae4e 100644 --- a/test/statsCases/exclude-with-loader/expected.txt +++ b/test/statsCases/exclude-with-loader/expected.txt @@ -1,4 +1,4 @@ -Hash: 14e131b4e5c91ed5ce4a +Hash: e901212ba1092de427e5 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.92 kB 0 [emitted] main diff --git a/test/statsCases/external/expected.txt b/test/statsCases/external/expected.txt index 155880576..d924ad4ae 100644 --- a/test/statsCases/external/expected.txt +++ b/test/statsCases/external/expected.txt @@ -1,4 +1,4 @@ -Hash: 86950abf8dcf924d9cc1 +Hash: 4c30cb7f04bc6b5ff7d7 Time: Xms Asset Size Chunks Chunk Names main.js 2.61 kB 0 [emitted] main diff --git a/test/statsCases/filter-warnings/expected.txt b/test/statsCases/filter-warnings/expected.txt index 37608dea4..a5d8381e6 100644 --- a/test/statsCases/filter-warnings/expected.txt +++ b/test/statsCases/filter-warnings/expected.txt @@ -1,6 +1,6 @@ -Hash: 3cc7bf529a74b021bee53cc7bf529a74b021bee53cc7bf529a74b021bee53cc7bf529a74b021bee53cc7bf529a74b021bee53cc7bf529a74b021bee53cc7bf529a74b021bee53cc7bf529a74b021bee53cc7bf529a74b021bee53cc7bf529a74b021bee53cc7bf529a74b021bee53cc7bf529a74b021bee53cc7bf529a74b021bee5 +Hash: e743b7134905e5d0c58ae743b7134905e5d0c58ae743b7134905e5d0c58ae743b7134905e5d0c58ae743b7134905e5d0c58ae743b7134905e5d0c58ae743b7134905e5d0c58ae743b7134905e5d0c58ae743b7134905e5d0c58ae743b7134905e5d0c58ae743b7134905e5d0c58ae743b7134905e5d0c58ae743b7134905e5d0c58a Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main @@ -18,37 +18,37 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main @@ -66,7 +66,7 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main @@ -84,7 +84,7 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main @@ -102,7 +102,7 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main @@ -120,7 +120,7 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main @@ -138,7 +138,7 @@ Child Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] Child - Hash: 3cc7bf529a74b021bee5 + Hash: e743b7134905e5d0c58a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main diff --git a/test/statsCases/import-weak/expected.txt b/test/statsCases/import-weak/expected.txt index 00282baa3..b7d120720 100644 --- a/test/statsCases/import-weak/expected.txt +++ b/test/statsCases/import-weak/expected.txt @@ -1,8 +1,8 @@ -Hash: d34cc0bd2faeb65c3282 +Hash: 00bdc9e68dab6471776c Time: Xms - Asset Size Chunks Chunk Names - 0.js 99 bytes 0 [emitted] -entry.js 6.22 kB 1 [emitted] entry + Asset Size Chunks Chunk Names + 0.js 149 bytes 0 [emitted] +entry.js 6.54 kB 1 [emitted] entry [0] (webpack)/test/statsCases/import-weak/modules/b.js 22 bytes {0} [built] [1] (webpack)/test/statsCases/import-weak/entry.js 120 bytes {1} [built] [2] (webpack)/test/statsCases/import-weak/modules/a.js 37 bytes [built] \ No newline at end of file diff --git a/test/statsCases/limit-chunk-count-plugin/expected.txt b/test/statsCases/limit-chunk-count-plugin/expected.txt index e020942cc..cfb215fc4 100644 --- a/test/statsCases/limit-chunk-count-plugin/expected.txt +++ b/test/statsCases/limit-chunk-count-plugin/expected.txt @@ -1,6 +1,6 @@ -Hash: e0c3e190f6cf11c37f15b34fa5f72acbbc9cbd9a404c277a8869b8a6a62e5c32ec6fc2ff40a3b587 +Hash: 46a7a39ec383c6479bea3e8c58141126afe0bf8ff50878d3027cf0a3fce6ee5a7f05473b5f3a79b9 Child - Hash: e0c3e190f6cf11c37f15 + Hash: 46a7a39ec383c6479bea Time: Xms Asset Size Chunks Chunk Names bundle.js 3.4 kB 0 [emitted] main @@ -12,11 +12,11 @@ Child [4] (webpack)/test/statsCases/limit-chunk-count-plugin/d.js 22 bytes {0} [built] [5] (webpack)/test/statsCases/limit-chunk-count-plugin/e.js 22 bytes {0} [built] Child - Hash: b34fa5f72acbbc9cbd9a + Hash: 3e8c58141126afe0bf8f Time: Xms Asset Size Chunks Chunk Names - 0.bundle.js 601 bytes 0 [emitted] - bundle.js 6.12 kB 1 [emitted] main + 0.bundle.js 651 bytes 0 [emitted] + bundle.js 6.44 kB 1 [emitted] main chunk {0} 0.bundle.js 118 bytes {1} [rendered] [1] (webpack)/test/statsCases/limit-chunk-count-plugin/a.js 22 bytes {0} [built] [2] (webpack)/test/statsCases/limit-chunk-count-plugin/b.js 22 bytes {0} [built] @@ -26,12 +26,12 @@ Child chunk {1} bundle.js (main) 73 bytes [entry] [rendered] [0] (webpack)/test/statsCases/limit-chunk-count-plugin/index.js 73 bytes {1} [built] Child - Hash: 404c277a8869b8a6a62e + Hash: f50878d3027cf0a3fce6 Time: Xms Asset Size Chunks Chunk Names - 0.bundle.js 454 bytes 0 [emitted] - 1.bundle.js 182 bytes 1 [emitted] - bundle.js 6.11 kB 2 [emitted] main + 0.bundle.js 504 bytes 0 [emitted] + 1.bundle.js 232 bytes 1 [emitted] + bundle.js 6.43 kB 2 [emitted] main chunk {0} 0.bundle.js 74 bytes {2} [rendered] [1] (webpack)/test/statsCases/limit-chunk-count-plugin/a.js 22 bytes {0} [built] [3] (webpack)/test/statsCases/limit-chunk-count-plugin/c.js 30 bytes {0} [built] @@ -42,13 +42,13 @@ Child chunk {2} bundle.js (main) 73 bytes [entry] [rendered] [0] (webpack)/test/statsCases/limit-chunk-count-plugin/index.js 73 bytes {2} [built] Child - Hash: 5c32ec6fc2ff40a3b587 + Hash: ee5a7f05473b5f3a79b9 Time: Xms Asset Size Chunks Chunk Names - 0.bundle.js 182 bytes 0 [emitted] - 1.bundle.js 204 bytes 1 [emitted] - 2.bundle.js 283 bytes 2 [emitted] - bundle.js 6.1 kB 3 [emitted] main + 0.bundle.js 232 bytes 0 [emitted] + 1.bundle.js 254 bytes 1 [emitted] + 2.bundle.js 333 bytes 2 [emitted] + bundle.js 6.42 kB 3 [emitted] main chunk {0} 0.bundle.js 44 bytes {2} {3} [rendered] [2] (webpack)/test/statsCases/limit-chunk-count-plugin/b.js 22 bytes {0} [built] [5] (webpack)/test/statsCases/limit-chunk-count-plugin/e.js 22 bytes {0} [built] diff --git a/test/statsCases/max-modules-default/expected.txt b/test/statsCases/max-modules-default/expected.txt index e4cee1b02..c3a5d3d55 100644 --- a/test/statsCases/max-modules-default/expected.txt +++ b/test/statsCases/max-modules-default/expected.txt @@ -1,4 +1,4 @@ -Hash: b70eb677e8a8b3694c25 +Hash: 510b13d517c125d60c88 Time: Xms Asset Size Chunks Chunk Names main.js 5.79 kB 0 [emitted] main diff --git a/test/statsCases/max-modules/expected.txt b/test/statsCases/max-modules/expected.txt index 9303956d2..48ef0139b 100644 --- a/test/statsCases/max-modules/expected.txt +++ b/test/statsCases/max-modules/expected.txt @@ -1,4 +1,4 @@ -Hash: b70eb677e8a8b3694c25 +Hash: 510b13d517c125d60c88 Time: Xms Asset Size Chunks Chunk Names main.js 5.79 kB 0 [emitted] main diff --git a/test/statsCases/named-chunks-plugin-async/expected.txt b/test/statsCases/named-chunks-plugin-async/expected.txt index 809ff0492..3ef5329d2 100644 --- a/test/statsCases/named-chunks-plugin-async/expected.txt +++ b/test/statsCases/named-chunks-plugin-async/expected.txt @@ -1,9 +1,9 @@ -Hash: ad8adb01e611de794006 +Hash: 668d0eb74d7650731352 Time: Xms Asset Size Chunks Chunk Names -chunk-containing-__a_js.js 266 bytes chunk-containing-__a_js [emitted] -chunk-containing-__b_js.js 123 bytes chunk-containing-__b_js [emitted] - entry.js 5.99 kB entry [emitted] entry +chunk-containing-__a_js.js 316 bytes chunk-containing-__a_js [emitted] +chunk-containing-__b_js.js 173 bytes chunk-containing-__b_js [emitted] + entry.js 6.32 kB entry [emitted] entry [0] (webpack)/test/statsCases/named-chunks-plugin-async/modules/b.js 22 bytes {chunk-containing-__b_js} [built] [1] (webpack)/test/statsCases/named-chunks-plugin-async/entry.js 47 bytes {entry} [built] [2] (webpack)/test/statsCases/named-chunks-plugin-async/modules/a.js 37 bytes {chunk-containing-__a_js} [built] \ No newline at end of file diff --git a/test/statsCases/named-chunks-plugin/expected.txt b/test/statsCases/named-chunks-plugin/expected.txt index e19f2054f..26f006978 100644 --- a/test/statsCases/named-chunks-plugin/expected.txt +++ b/test/statsCases/named-chunks-plugin/expected.txt @@ -1,11 +1,11 @@ -Hash: ac63e5be974bcdfea3a3 +Hash: e2a3a4f76d4a30adbf3e Time: Xms Asset Size Chunks Chunk Names - entry.js 345 bytes entry [emitted] entry -manifest.js 5.78 kB manifest [emitted] manifest - vendor.js 397 bytes vendor [emitted] vendor + entry.js 617 bytes entry [emitted] entry +manifest.js 6.53 kB manifest [emitted] manifest + vendor.js 471 bytes vendor [emitted] vendor [0] multi ./modules/a ./modules/b 40 bytes {vendor} [built] [./entry.js] (webpack)/test/statsCases/named-chunks-plugin/entry.js 72 bytes {entry} [built] -[./modules/a.js] (webpack)/test/statsCases/named-chunks-plugin/modules/a.js 22 bytes {vendor} [built] -[./modules/b.js] (webpack)/test/statsCases/named-chunks-plugin/modules/b.js 22 bytes {vendor} [built] +[./modules/a.js] (webpack)/test/statsCases/named-chunks-plugin/modules/a.js 22 bytes {entry} {vendor} [built] +[./modules/b.js] (webpack)/test/statsCases/named-chunks-plugin/modules/b.js 22 bytes {entry} {vendor} [built] [./modules/c.js] (webpack)/test/statsCases/named-chunks-plugin/modules/c.js 22 bytes {entry} [built] \ No newline at end of file diff --git a/test/statsCases/optimize-chunks/expected.txt b/test/statsCases/optimize-chunks/expected.txt index 9a932b565..aecce00ee 100644 --- a/test/statsCases/optimize-chunks/expected.txt +++ b/test/statsCases/optimize-chunks/expected.txt @@ -1,14 +1,14 @@ -Hash: 9a598b7aa486cde5256a +Hash: 284de8edb2496f0ce72d Time: Xms Asset Size Chunks Chunk Names - 0.js 231 bytes 0 [emitted] cir1 - 1.js 209 bytes 1, 2 [emitted] abd - 2.js 133 bytes 2 [emitted] ab - 3.js 246 bytes 3 [emitted] cir2 - 4.js 162 bytes 4, 6 [emitted] chunk - 5.js 306 bytes 5, 3 [emitted] cir2 from cir1 - 6.js 80 bytes 6 [emitted] ac in ab -main.js 6.78 kB 7 [emitted] main + 0.js 281 bytes 0 [emitted] cir1 + 1.js 259 bytes 1, 2 [emitted] abd + 2.js 183 bytes 2 [emitted] ab + 3.js 296 bytes 3 [emitted] cir2 + 4.js 212 bytes 4, 6 [emitted] chunk + 5.js 356 bytes 5, 3 [emitted] cir2 from cir1 + 6.js 130 bytes 6 [emitted] ac in ab +main.js 7.1 kB 7 [emitted] main chunk {0} 0.js (cir1) 81 bytes {3} {5} {7} [rendered] > duplicate cir1 from cir2 [6] (webpack)/test/statsCases/optimize-chunks/circular2.js 1:0-79 > duplicate cir1 [7] (webpack)/test/statsCases/optimize-chunks/index.js 13:0-54 diff --git a/test/statsCases/performance-disabled/expected.txt b/test/statsCases/performance-disabled/expected.txt index 8c700e931..768e028a0 100644 --- a/test/statsCases/performance-disabled/expected.txt +++ b/test/statsCases/performance-disabled/expected.txt @@ -1,8 +1,8 @@ Time: Xms Asset Size Chunks Chunk Names - 0.js 238 bytes 0 [emitted] - 1.js 102 bytes 1 [emitted] - 2.js 182 bytes 2 [emitted] + 0.js 288 bytes 0 [emitted] + 1.js 152 bytes 1 [emitted] + 2.js 232 bytes 2 [emitted] main.js 306 kB 3 [emitted] main Entrypoint main = main.js [0] (webpack)/test/statsCases/performance-disabled/index.js 52 bytes {3} [built] diff --git a/test/statsCases/performance-error/expected.txt b/test/statsCases/performance-error/expected.txt index 57c4f2d85..75ebee55d 100644 --- a/test/statsCases/performance-error/expected.txt +++ b/test/statsCases/performance-error/expected.txt @@ -1,8 +1,8 @@ Time: Xms Asset Size Chunks Chunk Names - 0.js 238 bytes 0 [emitted] - 1.js 102 bytes 1 [emitted] - 2.js 182 bytes 2 [emitted] + 0.js 288 bytes 0 [emitted] + 1.js 152 bytes 1 [emitted] + 2.js 232 bytes 2 [emitted] main.js 306 kB 3 [emitted] [big] main Entrypoint main [big] = main.js [0] (webpack)/test/statsCases/performance-error/index.js 52 bytes {3} [built] diff --git a/test/statsCases/performance-no-hints/expected.txt b/test/statsCases/performance-no-hints/expected.txt index e044be0ff..b21d01e15 100644 --- a/test/statsCases/performance-no-hints/expected.txt +++ b/test/statsCases/performance-no-hints/expected.txt @@ -1,8 +1,8 @@ Time: Xms Asset Size Chunks Chunk Names - 0.js 238 bytes 0 [emitted] - 1.js 102 bytes 1 [emitted] - 2.js 182 bytes 2 [emitted] + 0.js 288 bytes 0 [emitted] + 1.js 152 bytes 1 [emitted] + 2.js 232 bytes 2 [emitted] main.js 306 kB 3 [emitted] [big] main Entrypoint main [big] = main.js [0] (webpack)/test/statsCases/performance-no-hints/index.js 52 bytes {3} [built] diff --git a/test/statsCases/preset-detailed/expected.txt b/test/statsCases/preset-detailed/expected.txt index d4b48f326..06eea8ccf 100644 --- a/test/statsCases/preset-detailed/expected.txt +++ b/test/statsCases/preset-detailed/expected.txt @@ -1,10 +1,10 @@ -Hash: fd034b07589b0d56afb3 +Hash: 0556d5e48c7f2a7728b3 Time: Xms Asset Size Chunks Chunk Names - 0.js 238 bytes 0 [emitted] - 1.js 102 bytes 1 [emitted] - 2.js 182 bytes 2 [emitted] -main.js 6.1 kB 3 [emitted] main + 0.js 288 bytes 0 [emitted] + 1.js 152 bytes 1 [emitted] + 2.js 232 bytes 2 [emitted] +main.js 6.42 kB 3 [emitted] main Entrypoint main = main.js chunk {0} 0.js 54 bytes {3} [rendered] > [0] (webpack)/test/statsCases/preset-detailed/index.js 3:0-16 diff --git a/test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/expected.txt b/test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/expected.txt index 33bec0f02..b7a2eab0b 100644 --- a/test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/expected.txt +++ b/test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/expected.txt @@ -1,8 +1,8 @@ Time: Xms Asset Size Chunks Chunk Names - 0.js 268 bytes 0 [emitted] - 1.js 132 bytes 1 [emitted] - 2.js 212 bytes 2 [emitted] + 0.js 318 bytes 0 [emitted] + 1.js 182 bytes 1 [emitted] + 2.js 262 bytes 2 [emitted] main.js 306 kB 3 [emitted] [big] main 0.js.map 291 bytes 0 [emitted] 1.js.map 250 bytes 1 [emitted] diff --git a/test/statsCases/preset-normal-performance/expected.txt b/test/statsCases/preset-normal-performance/expected.txt index b7d797ecb..38e7b9ae8 100644 --- a/test/statsCases/preset-normal-performance/expected.txt +++ b/test/statsCases/preset-normal-performance/expected.txt @@ -1,8 +1,8 @@ Time: Xms Asset Size Chunks Chunk Names - 0.js 238 bytes 0 [emitted] - 1.js 102 bytes 1 [emitted] - 2.js 182 bytes 2 [emitted] + 0.js 288 bytes 0 [emitted] + 1.js 152 bytes 1 [emitted] + 2.js 232 bytes 2 [emitted] main.js 306 kB 3 [emitted] [big] main [0] (webpack)/test/statsCases/preset-normal-performance/index.js 52 bytes {3} [built] [1] (webpack)/test/statsCases/preset-normal-performance/a.js 300 kB {3} [built] diff --git a/test/statsCases/preset-normal/expected.txt b/test/statsCases/preset-normal/expected.txt index 80a51e555..548f7b08c 100644 --- a/test/statsCases/preset-normal/expected.txt +++ b/test/statsCases/preset-normal/expected.txt @@ -1,10 +1,10 @@ -Hash: fd034b07589b0d56afb3 +Hash: 0556d5e48c7f2a7728b3 Time: Xms Asset Size Chunks Chunk Names - 0.js 238 bytes 0 [emitted] - 1.js 102 bytes 1 [emitted] - 2.js 182 bytes 2 [emitted] -main.js 6.1 kB 3 [emitted] main + 0.js 288 bytes 0 [emitted] + 1.js 152 bytes 1 [emitted] + 2.js 232 bytes 2 [emitted] +main.js 6.42 kB 3 [emitted] main [0] (webpack)/test/statsCases/preset-normal/index.js 51 bytes {3} [built] [1] (webpack)/test/statsCases/preset-normal/a.js 22 bytes {3} [built] [2] (webpack)/test/statsCases/preset-normal/b.js 22 bytes {1} [built] diff --git a/test/statsCases/preset-verbose/expected.txt b/test/statsCases/preset-verbose/expected.txt index 686bf3a65..d6ba109df 100644 --- a/test/statsCases/preset-verbose/expected.txt +++ b/test/statsCases/preset-verbose/expected.txt @@ -1,10 +1,10 @@ -Hash: fd034b07589b0d56afb3 +Hash: 0556d5e48c7f2a7728b3 Time: Xms Asset Size Chunks Chunk Names - 0.js 238 bytes 0 [emitted] - 1.js 102 bytes 1 [emitted] - 2.js 182 bytes 2 [emitted] -main.js 6.1 kB 3 [emitted] main + 0.js 288 bytes 0 [emitted] + 1.js 152 bytes 1 [emitted] + 2.js 232 bytes 2 [emitted] +main.js 6.42 kB 3 [emitted] main Entrypoint main = main.js chunk {0} 0.js 54 bytes {3} [rendered] > [0] (webpack)/test/statsCases/preset-verbose/index.js 3:0-16 diff --git a/test/statsCases/resolve-plugin-context/expected.txt b/test/statsCases/resolve-plugin-context/expected.txt index 033a761bd..055464467 100644 --- a/test/statsCases/resolve-plugin-context/expected.txt +++ b/test/statsCases/resolve-plugin-context/expected.txt @@ -1,4 +1,4 @@ -Hash: 94e1d97f3e1cf37e753f +Hash: 4ffa8a63eba9a73bd83a Time: Xms Asset Size Chunks Chunk Names bundle.js 2.88 kB 0 [emitted] main diff --git a/test/statsCases/reverse-sort-modules/expected.txt b/test/statsCases/reverse-sort-modules/expected.txt index 7ce77ddc3..26e2c0bce 100644 --- a/test/statsCases/reverse-sort-modules/expected.txt +++ b/test/statsCases/reverse-sort-modules/expected.txt @@ -1,4 +1,4 @@ -Hash: b70eb677e8a8b3694c25 +Hash: 510b13d517c125d60c88 Time: Xms Asset Size Chunks Chunk Names main.js 5.79 kB 0 [emitted] main diff --git a/test/statsCases/scope-hoisting-multi/expected.txt b/test/statsCases/scope-hoisting-multi/expected.txt index 2e22554d8..d721928bc 100644 --- a/test/statsCases/scope-hoisting-multi/expected.txt +++ b/test/statsCases/scope-hoisting-multi/expected.txt @@ -1,6 +1,6 @@ -Hash: 731069e082cf620521cea66588099dc6439215ab +Hash: 9a1ba44f60599afb5d545ba55a77112cca5f2a42 Child - Hash: 731069e082cf620521ce + Hash: 9a1ba44f60599afb5d54 Time: Xms [0] (webpack)/test/statsCases/scope-hoisting-multi/common_lazy_shared.js 25 bytes {0} {1} {2} [built] [1] (webpack)/test/statsCases/scope-hoisting-multi/vendor.js 25 bytes {5} [built] @@ -14,7 +14,7 @@ Child [9] (webpack)/test/statsCases/scope-hoisting-multi/second.js 177 bytes {4} [built] [10] (webpack)/test/statsCases/scope-hoisting-multi/lazy_second.js 55 bytes {1} [built] Child - Hash: a66588099dc6439215ab + Hash: 5ba55a77112cca5f2a42 Time: Xms [0] (webpack)/test/statsCases/scope-hoisting-multi/common_lazy_shared.js 25 bytes {0} {1} {2} [built] [1] (webpack)/test/statsCases/scope-hoisting-multi/vendor.js 25 bytes {5} [built] diff --git a/test/statsCases/separate-css-bundle/expected.txt b/test/statsCases/separate-css-bundle/expected.txt index 752a6975d..79667332d 100644 --- a/test/statsCases/separate-css-bundle/expected.txt +++ b/test/statsCases/separate-css-bundle/expected.txt @@ -1,9 +1,9 @@ -Hash: a3f5cb0c4f2d75d79214074bc8c917dae9eb215a +Hash: da212ebe137c4652925fee9f676067a60342413c Child - Hash: a3f5cb0c4f2d75d79214 + Hash: da212ebe137c4652925f Time: Xms Asset Size Chunks Chunk Names - 5a21b890f95ec575ba49.js 2.62 kB 0 [emitted] main + fd9bad62ebd7cda4d760.js 2.62 kB 0 [emitted] main c815cf440254d4f3bba4e7041db00a28.css 26 bytes 0 [emitted] main [0] (webpack)/test/statsCases/separate-css-bundle/a/index.js 23 bytes {0} [built] [1] (webpack)/test/statsCases/separate-css-bundle/a/file.css 41 bytes {0} [built] @@ -15,10 +15,10 @@ Child [0] (webpack)/node_modules/css-loader!(webpack)/test/statsCases/separate-css-bundle/a/file.css 199 bytes {0} [built] [1] (webpack)/node_modules/css-loader/lib/css-base.js 2.26 kB {0} [built] Child - Hash: 074bc8c917dae9eb215a + Hash: ee9f676067a60342413c Time: Xms Asset Size Chunks Chunk Names - 5a21b890f95ec575ba49.js 2.62 kB 0 [emitted] main + fd9bad62ebd7cda4d760.js 2.62 kB 0 [emitted] main a3f385680aef7a9bb2a517699532cc34.css 28 bytes 0 [emitted] main [0] (webpack)/test/statsCases/separate-css-bundle/b/index.js 23 bytes {0} [built] [1] (webpack)/test/statsCases/separate-css-bundle/b/file.css 41 bytes {0} [built] diff --git a/test/statsCases/simple-more-info/expected.txt b/test/statsCases/simple-more-info/expected.txt index ecf254996..e29f330ec 100644 --- a/test/statsCases/simple-more-info/expected.txt +++ b/test/statsCases/simple-more-info/expected.txt @@ -1,4 +1,4 @@ -Hash: 0bd4f09244f0e8c60354 +Hash: 4df41ff8ebd516be0a28 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.47 kB 0 [emitted] main diff --git a/test/statsCases/simple/expected.txt b/test/statsCases/simple/expected.txt index 4974e2530..451f301b4 100644 --- a/test/statsCases/simple/expected.txt +++ b/test/statsCases/simple/expected.txt @@ -1,4 +1,4 @@ -Hash: 0bd4f09244f0e8c60354 +Hash: 4df41ff8ebd516be0a28 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.47 kB 0 [emitted] main diff --git a/test/statsCases/tree-shaking/expected.txt b/test/statsCases/tree-shaking/expected.txt index d60eb28d0..5af10d4e1 100644 --- a/test/statsCases/tree-shaking/expected.txt +++ b/test/statsCases/tree-shaking/expected.txt @@ -1,4 +1,4 @@ -Hash: d655480cef20a0a12dff +Hash: 770e147adc3a475e61dc Time: Xms Asset Size Chunks Chunk Names bundle.js 7.33 kB 0 [emitted] main diff --git a/test/statsCases/warnings-uglifyjs/expected.txt b/test/statsCases/warnings-uglifyjs/expected.txt index 1e79500ce..86baf9aed 100644 --- a/test/statsCases/warnings-uglifyjs/expected.txt +++ b/test/statsCases/warnings-uglifyjs/expected.txt @@ -1,4 +1,4 @@ -Hash: 2c9851f0ea4c9778e64a +Hash: cf63b6ddede66b99c822 Time: Xms Asset Size Chunks Chunk Names bundle.js 2.1 kB 0 [emitted] main From 04a63bf6f647d94086af405fd43ef836ad79cb35 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 14 Sep 2017 08:30:07 +0200 Subject: [PATCH 2/4] add test cases and optimizes output array --- lib/JsonpChunkTemplatePlugin.js | 2 +- lib/JsonpMainTemplatePlugin.js | 6 +++--- .../commons-chunk-plugin/correct-order/a.js | 1 + .../commons-chunk-plugin/correct-order/index.js | 13 +++++++++++++ .../correct-order/test.config.js | 8 ++++++++ .../correct-order/webpack.config.js | 16 ++++++++++++++++ .../commons-chunk-plugin/inverted-order/a.js | 1 + .../commons-chunk-plugin/inverted-order/index.js | 13 +++++++++++++ .../inverted-order/test.config.js | 8 ++++++++ .../inverted-order/webpack.config.js | 16 ++++++++++++++++ .../commons-chunk-min-size-0/expected.txt | 4 ++-- .../commons-plugin-issue-4980/expected.txt | 4 ++-- test/statsCases/named-chunks-plugin/expected.txt | 6 +++--- 13 files changed, 87 insertions(+), 11 deletions(-) create mode 100644 test/configCases/commons-chunk-plugin/correct-order/a.js create mode 100644 test/configCases/commons-chunk-plugin/correct-order/index.js create mode 100644 test/configCases/commons-chunk-plugin/correct-order/test.config.js create mode 100644 test/configCases/commons-chunk-plugin/correct-order/webpack.config.js create mode 100644 test/configCases/commons-chunk-plugin/inverted-order/a.js create mode 100644 test/configCases/commons-chunk-plugin/inverted-order/index.js create mode 100644 test/configCases/commons-chunk-plugin/inverted-order/test.config.js create mode 100644 test/configCases/commons-chunk-plugin/inverted-order/webpack.config.js diff --git a/lib/JsonpChunkTemplatePlugin.js b/lib/JsonpChunkTemplatePlugin.js index af404c7f7..639003369 100644 --- a/lib/JsonpChunkTemplatePlugin.js +++ b/lib/JsonpChunkTemplatePlugin.js @@ -15,7 +15,7 @@ class JsonpChunkTemplatePlugin { source.add(modules); const entries = [chunk.entryModule] .filter(Boolean) - .map(m => [chunk.entrypoints[0].chunks.map(c => c.id), m.id]); + .map(m => [m.id].concat(chunk.entrypoints[0].chunks.map(c => c.id))); if(entries.length > 0) { source.add(`,${JSON.stringify(entries)}`); } diff --git a/lib/JsonpMainTemplatePlugin.js b/lib/JsonpMainTemplatePlugin.js index 0f4538406..c1b2e9064 100644 --- a/lib/JsonpMainTemplatePlugin.js +++ b/lib/JsonpMainTemplatePlugin.js @@ -167,16 +167,16 @@ class JsonpMainTemplatePlugin { this.indent([ "var scheduledModule = scheduledModules[i];", "var fullfilled = true;", - "for(var j = 0; j < scheduledModule[0].length; j++) {", + "for(var j = 1; j < scheduledModule.length; j++) {", this.indent([ - "var depId = scheduledModule[0][j];", + "var depId = scheduledModule[j];", "if(installedChunks[depId] !== 0) fullfilled = false;" ]), "}", "if(fullfilled) {", this.indent([ "scheduledModules.splice(i--, 1);", - "result = " + this.requireFn + "(" + this.requireFn + ".s = scheduledModule[1]);", + "result = " + this.requireFn + "(" + this.requireFn + ".s = scheduledModule[0]);", ]), "}" ]), diff --git a/test/configCases/commons-chunk-plugin/correct-order/a.js b/test/configCases/commons-chunk-plugin/correct-order/a.js new file mode 100644 index 000000000..6cd1d0075 --- /dev/null +++ b/test/configCases/commons-chunk-plugin/correct-order/a.js @@ -0,0 +1 @@ +module.exports = "a"; diff --git a/test/configCases/commons-chunk-plugin/correct-order/index.js b/test/configCases/commons-chunk-plugin/correct-order/index.js new file mode 100644 index 000000000..10d9a9900 --- /dev/null +++ b/test/configCases/commons-chunk-plugin/correct-order/index.js @@ -0,0 +1,13 @@ +require("should"); + +var a = require("./a"); + +it("should run", function() { + a.should.be.eql("a"); +}); + +var mainModule = require.main; + +it("should be main", function() { + mainModule.should.be.eql(module); +}); diff --git a/test/configCases/commons-chunk-plugin/correct-order/test.config.js b/test/configCases/commons-chunk-plugin/correct-order/test.config.js new file mode 100644 index 000000000..4b70a8281 --- /dev/null +++ b/test/configCases/commons-chunk-plugin/correct-order/test.config.js @@ -0,0 +1,8 @@ +module.exports = { + findBundle: function(i, options) { + return [ + "./vendor.js", + "./main.js" + ] + } +}; diff --git a/test/configCases/commons-chunk-plugin/correct-order/webpack.config.js b/test/configCases/commons-chunk-plugin/correct-order/webpack.config.js new file mode 100644 index 000000000..5bd7a1553 --- /dev/null +++ b/test/configCases/commons-chunk-plugin/correct-order/webpack.config.js @@ -0,0 +1,16 @@ +var CommonsChunkPlugin = require("../../../../lib/optimize/CommonsChunkPlugin"); +module.exports = { + entry: { + vendor: ["./a"], + main: "./index" + }, + target: "web", + output: { + filename: "[name].js" + }, + plugins: [ + new CommonsChunkPlugin({ + name: "vendor" + }) + ] +}; diff --git a/test/configCases/commons-chunk-plugin/inverted-order/a.js b/test/configCases/commons-chunk-plugin/inverted-order/a.js new file mode 100644 index 000000000..6cd1d0075 --- /dev/null +++ b/test/configCases/commons-chunk-plugin/inverted-order/a.js @@ -0,0 +1 @@ +module.exports = "a"; diff --git a/test/configCases/commons-chunk-plugin/inverted-order/index.js b/test/configCases/commons-chunk-plugin/inverted-order/index.js new file mode 100644 index 000000000..10d9a9900 --- /dev/null +++ b/test/configCases/commons-chunk-plugin/inverted-order/index.js @@ -0,0 +1,13 @@ +require("should"); + +var a = require("./a"); + +it("should run", function() { + a.should.be.eql("a"); +}); + +var mainModule = require.main; + +it("should be main", function() { + mainModule.should.be.eql(module); +}); diff --git a/test/configCases/commons-chunk-plugin/inverted-order/test.config.js b/test/configCases/commons-chunk-plugin/inverted-order/test.config.js new file mode 100644 index 000000000..9f3aeae9a --- /dev/null +++ b/test/configCases/commons-chunk-plugin/inverted-order/test.config.js @@ -0,0 +1,8 @@ +module.exports = { + findBundle: function(i, options) { + return [ + "./main.js", + "./vendor.js" + ] + } +}; diff --git a/test/configCases/commons-chunk-plugin/inverted-order/webpack.config.js b/test/configCases/commons-chunk-plugin/inverted-order/webpack.config.js new file mode 100644 index 000000000..5bd7a1553 --- /dev/null +++ b/test/configCases/commons-chunk-plugin/inverted-order/webpack.config.js @@ -0,0 +1,16 @@ +var CommonsChunkPlugin = require("../../../../lib/optimize/CommonsChunkPlugin"); +module.exports = { + entry: { + vendor: ["./a"], + main: "./index" + }, + target: "web", + output: { + filename: "[name].js" + }, + plugins: [ + new CommonsChunkPlugin({ + name: "vendor" + }) + ] +}; diff --git a/test/statsCases/commons-chunk-min-size-0/expected.txt b/test/statsCases/commons-chunk-min-size-0/expected.txt index 82c8f4b98..e50f9f80f 100644 --- a/test/statsCases/commons-chunk-min-size-0/expected.txt +++ b/test/statsCases/commons-chunk-min-size-0/expected.txt @@ -1,8 +1,8 @@ Hash: e2982ecf41bd0a7eda73 Time: Xms Asset Size Chunks Chunk Names - entry-1.js 83 bytes 0 [emitted] entry-1 -vendor-1.js 7.51 kB 1 [emitted] vendor-1 + entry-1.js 81 bytes 0 [emitted] entry-1 +vendor-1.js 7.5 kB 1 [emitted] vendor-1 [0] (webpack)/test/statsCases/commons-chunk-min-size-0/modules/a.js 22 bytes {1} [built] [1] (webpack)/test/statsCases/commons-chunk-min-size-0/modules/b.js 22 bytes {1} [built] [2] (webpack)/test/statsCases/commons-chunk-min-size-0/modules/c.js 22 bytes {1} [built] diff --git a/test/statsCases/commons-plugin-issue-4980/expected.txt b/test/statsCases/commons-plugin-issue-4980/expected.txt index e14f21702..0609a08a5 100644 --- a/test/statsCases/commons-plugin-issue-4980/expected.txt +++ b/test/statsCases/commons-plugin-issue-4980/expected.txt @@ -5,7 +5,7 @@ Child Asset Size Chunks Chunk Names app.js 1.33 kB 0 [emitted] app vendor.76e65ef421e93d510398.js 493 bytes 1 [emitted] vendor - runtime.js 6.52 kB 2 [emitted] runtime + runtime.js 6.51 kB 2 [emitted] runtime [./constants.js] (webpack)/test/statsCases/commons-plugin-issue-4980/constants.js 87 bytes {1} [built] [./entry-1.js] (webpack)/test/statsCases/commons-plugin-issue-4980/entry-1.js 67 bytes {0} [built] [./submodule-a.js] (webpack)/test/statsCases/commons-plugin-issue-4980/submodule-a.js 59 bytes {0} [built] @@ -16,7 +16,7 @@ Child Asset Size Chunks Chunk Names app.js 1.38 kB 0 [emitted] app vendor.76e65ef421e93d510398.js 493 bytes 1 [emitted] vendor - runtime.js 6.52 kB 2 [emitted] runtime + runtime.js 6.51 kB 2 [emitted] runtime [./constants.js] (webpack)/test/statsCases/commons-plugin-issue-4980/constants.js 87 bytes {1} [built] [./entry-2.js] (webpack)/test/statsCases/commons-plugin-issue-4980/entry-2.js 67 bytes {0} [built] [./submodule-a.js] (webpack)/test/statsCases/commons-plugin-issue-4980/submodule-a.js 59 bytes {0} [built] diff --git a/test/statsCases/named-chunks-plugin/expected.txt b/test/statsCases/named-chunks-plugin/expected.txt index 26f006978..3976064a2 100644 --- a/test/statsCases/named-chunks-plugin/expected.txt +++ b/test/statsCases/named-chunks-plugin/expected.txt @@ -1,9 +1,9 @@ Hash: e2a3a4f76d4a30adbf3e Time: Xms Asset Size Chunks Chunk Names - entry.js 617 bytes entry [emitted] entry -manifest.js 6.53 kB manifest [emitted] manifest - vendor.js 471 bytes vendor [emitted] vendor + entry.js 615 bytes entry [emitted] entry +manifest.js 6.52 kB manifest [emitted] manifest + vendor.js 469 bytes vendor [emitted] vendor [0] multi ./modules/a ./modules/b 40 bytes {vendor} [built] [./entry.js] (webpack)/test/statsCases/named-chunks-plugin/entry.js 72 bytes {entry} [built] [./modules/a.js] (webpack)/test/statsCases/named-chunks-plugin/modules/a.js 22 bytes {entry} {vendor} [built] From 086a4c17803d0efe288f127844c305166f634a1f Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 14 Sep 2017 08:45:16 +0200 Subject: [PATCH 3/4] increase test timeout --- test/Stats.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Stats.test.js b/test/Stats.test.js index 980677f0b..d5c1d773f 100644 --- a/test/Stats.test.js +++ b/test/Stats.test.js @@ -98,7 +98,7 @@ describe("Stats", () => { actual.should.be.eql(expected); done(); }); - }); + }, 10000); }); describe("Error Handling", () => { describe("does have", () => { From 64aa63d6a8136e17d30698def4ac297c512f9b42 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 14 Sep 2017 14:46:38 +0200 Subject: [PATCH 4/4] increase coverage with test case remove unused code --- lib/Entrypoint.js | 15 ---- .../aggressive-splitting-entry/expected.txt | 75 +++++++++++++------ .../input-records-content-change.json | 38 ++++++++++ ...ecords.json => input-records-fitting.json} | 0 .../webpack.config.js | 9 ++- 5 files changed, 94 insertions(+), 43 deletions(-) create mode 100644 test/statsCases/aggressive-splitting-entry/input-records-content-change.json rename test/statsCases/aggressive-splitting-entry/{input-records.json => input-records-fitting.json} (100%) diff --git a/lib/Entrypoint.js b/lib/Entrypoint.js index 91d078a0d..8037fe5c5 100644 --- a/lib/Entrypoint.js +++ b/lib/Entrypoint.js @@ -10,13 +10,6 @@ class Entrypoint { this.chunks = []; } - removeChunk(chunk) { - var idx = this.chunks.indexOf(chunk); - if(idx >= 0) this.chunks.splice(idx, 1); - idx = chunk.entrypoints.indexOf(this); - if(idx >= 0) chunk.entrypoints.splice(idx, 1); - } - unshiftChunk(chunk) { this.chunks.unshift(chunk); chunk.entrypoints.push(this); @@ -37,14 +30,6 @@ class Entrypoint { } } - appendChunk(chunk) { - const idx = this.chunks.indexOf(chunk); - if(idx < 0) { - this.chunks.push(chunk); - chunk.entrypoints.push(this); - } - } - getFiles() { const files = []; diff --git a/test/statsCases/aggressive-splitting-entry/expected.txt b/test/statsCases/aggressive-splitting-entry/expected.txt index 6c07820ae..0bebbc828 100644 --- a/test/statsCases/aggressive-splitting-entry/expected.txt +++ b/test/statsCases/aggressive-splitting-entry/expected.txt @@ -1,24 +1,51 @@ -Hash: c55fcf171c46cbd1e5a1 -Time: Xms - Asset Size Chunks Chunk Names -9748a8a04a5102209105.js 2.29 kB 1 [emitted] -79e8b67b4f31cdb0299f.js 1.99 kB 2 [emitted] -628e75ea29b4a779b369.js 1.03 kB 3 [emitted] -dd43a4ed55c20668ec9b.js 5.72 kB 444 [emitted] -Entrypoint main = dd43a4ed55c20668ec9b.js 79e8b67b4f31cdb0299f.js 628e75ea29b4a779b369.js 9748a8a04a5102209105.js -chunk {1} 9748a8a04a5102209105.js 1.91 kB [initial] [rendered] - > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js - [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js 112 bytes {1} [built] - [6] (webpack)/test/statsCases/aggressive-splitting-entry/f.js 899 bytes {1} [built] - [7] (webpack)/test/statsCases/aggressive-splitting-entry/g.js 899 bytes {1} [built] -chunk {2} 79e8b67b4f31cdb0299f.js 1.8 kB [initial] [rendered] [recorded] - > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js - [2] (webpack)/test/statsCases/aggressive-splitting-entry/d.js 899 bytes {2} [built] - [5] (webpack)/test/statsCases/aggressive-splitting-entry/a.js 899 bytes {2} [built] -chunk {3} 628e75ea29b4a779b369.js 899 bytes [initial] [rendered] - > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js - [3] (webpack)/test/statsCases/aggressive-splitting-entry/e.js 899 bytes {3} [built] -chunk {444} dd43a4ed55c20668ec9b.js 1.8 kB [entry] [rendered] - > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js - [0] (webpack)/test/statsCases/aggressive-splitting-entry/b.js 899 bytes {444} [built] - [1] (webpack)/test/statsCases/aggressive-splitting-entry/c.js 899 bytes {444} [built] \ No newline at end of file +Hash: c55fcf171c46cbd1e5a1939ef65085fe14a681ab +Child fitting: + Hash: c55fcf171c46cbd1e5a1 + Time: Xms + Asset Size Chunks Chunk Names + 9748a8a04a5102209105.js 2.29 kB 1 [emitted] + 79e8b67b4f31cdb0299f.js 1.99 kB 2 [emitted] + 628e75ea29b4a779b369.js 1.03 kB 3 [emitted] + dd43a4ed55c20668ec9b.js 5.72 kB 444 [emitted] + Entrypoint main = dd43a4ed55c20668ec9b.js 79e8b67b4f31cdb0299f.js 628e75ea29b4a779b369.js 9748a8a04a5102209105.js + chunk {1} 9748a8a04a5102209105.js 1.91 kB [initial] [rendered] + > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js + [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js 112 bytes {1} [built] + [6] (webpack)/test/statsCases/aggressive-splitting-entry/f.js 899 bytes {1} [built] + [7] (webpack)/test/statsCases/aggressive-splitting-entry/g.js 899 bytes {1} [built] + chunk {2} 79e8b67b4f31cdb0299f.js 1.8 kB [initial] [rendered] [recorded] + > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js + [2] (webpack)/test/statsCases/aggressive-splitting-entry/d.js 899 bytes {2} [built] + [5] (webpack)/test/statsCases/aggressive-splitting-entry/a.js 899 bytes {2} [built] + chunk {3} 628e75ea29b4a779b369.js 899 bytes [initial] [rendered] + > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js + [3] (webpack)/test/statsCases/aggressive-splitting-entry/e.js 899 bytes {3} [built] + chunk {444} dd43a4ed55c20668ec9b.js 1.8 kB [entry] [rendered] + > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js + [0] (webpack)/test/statsCases/aggressive-splitting-entry/b.js 899 bytes {444} [built] + [1] (webpack)/test/statsCases/aggressive-splitting-entry/c.js 899 bytes {444} [built] +Child content-change: + Hash: 939ef65085fe14a681ab + Time: Xms + Asset Size Chunks Chunk Names + 20c5ea99991f201dd831.js 2.29 kB 0 [emitted] + f4d1e8f97994a643b1c9.js 1.98 kB 4 [emitted] + 8cd5c0e735c517a0371e.js 5.72 kB 5 [emitted] + ec77f695b8be7fca93f2.js 1.03 kB 6 [emitted] + Entrypoint main = 8cd5c0e735c517a0371e.js ec77f695b8be7fca93f2.js f4d1e8f97994a643b1c9.js 20c5ea99991f201dd831.js + chunk {0} 20c5ea99991f201dd831.js 1.91 kB [initial] [rendered] + > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js + [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js 112 bytes {0} [built] + [6] (webpack)/test/statsCases/aggressive-splitting-entry/f.js 899 bytes {0} [built] + [7] (webpack)/test/statsCases/aggressive-splitting-entry/g.js 899 bytes {0} [built] + chunk {4} f4d1e8f97994a643b1c9.js 1.8 kB [initial] [rendered] [recorded] + > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js + [0] (webpack)/test/statsCases/aggressive-splitting-entry/b.js 899 bytes {4} [built] + [1] (webpack)/test/statsCases/aggressive-splitting-entry/c.js 899 bytes {4} [built] + chunk {5} 8cd5c0e735c517a0371e.js 1.8 kB [entry] [rendered] [recorded] + > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js + [2] (webpack)/test/statsCases/aggressive-splitting-entry/d.js 899 bytes {5} [built] + [5] (webpack)/test/statsCases/aggressive-splitting-entry/a.js 899 bytes {5} [built] + chunk {6} ec77f695b8be7fca93f2.js 899 bytes [initial] [rendered] + > aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js + [3] (webpack)/test/statsCases/aggressive-splitting-entry/e.js 899 bytes {6} [built] \ No newline at end of file diff --git a/test/statsCases/aggressive-splitting-entry/input-records-content-change.json b/test/statsCases/aggressive-splitting-entry/input-records-content-change.json new file mode 100644 index 000000000..9f7d661f7 --- /dev/null +++ b/test/statsCases/aggressive-splitting-entry/input-records-content-change.json @@ -0,0 +1,38 @@ +{ + "modules": { + "byIdentifier": { + "b.js": 0, + "c.js": 1, + "d.js": 2, + "e.js": 3, + "index.js": 4, + "a.js": 5 + }, + "usedIds": { + "0": 0, + "1": 1, + "2": 2, + "3": 3, + "4": 4, + "5": 5 + } + }, + "chunks": { + "byName": {}, + "byBlocks": {}, + "usedIds": { + "0": 0, + "444": 444 + } + }, + "aggressiveSplits": [ + { + "modules": [ + "b.js", + "c.js" + ], + "hash": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "id": 444 + } + ] +} diff --git a/test/statsCases/aggressive-splitting-entry/input-records.json b/test/statsCases/aggressive-splitting-entry/input-records-fitting.json similarity index 100% rename from test/statsCases/aggressive-splitting-entry/input-records.json rename to test/statsCases/aggressive-splitting-entry/input-records-fitting.json diff --git a/test/statsCases/aggressive-splitting-entry/webpack.config.js b/test/statsCases/aggressive-splitting-entry/webpack.config.js index 4a7dbe532..6c35936dd 100644 --- a/test/statsCases/aggressive-splitting-entry/webpack.config.js +++ b/test/statsCases/aggressive-splitting-entry/webpack.config.js @@ -1,5 +1,6 @@ var webpack = require("../../../"); -module.exports = { +module.exports = ["fitting", "content-change"].map(type => ({ + name: type, entry: "./index", output: { filename: "[chunkhash].js", @@ -13,8 +14,8 @@ module.exports = { maxSize: 2500 }) ], - recordsInputPath: __dirname + "/input-records.json", - //recordsOutputPath: __dirname + "/records.json", + recordsInputPath: __dirname + `/input-records-${type}.json`, + //recordsOutputPath: __dirname + `/records-${type}.json`, stats: { chunks: true, chunkModules: true, @@ -23,4 +24,4 @@ module.exports = { modules: false, publicPath: true } -}; +}));