bugfix and test for graph correctness

This commit is contained in:
Tobias Koppers 2017-10-11 11:13:36 +02:00
parent 2df0bf1082
commit 91df794788
10 changed files with 54 additions and 1 deletions

View File

@ -579,7 +579,7 @@ class Compilation extends Tapable {
self.assignIndex(module);
self.assignDepth(module);
});
self.processDependenciesBlocksForChunks(self.chunks);
self.processDependenciesBlocksForChunks(self.chunks.slice());
self.sortModules(self.modules);
self.applyPlugins0("optimize");

View File

@ -0,0 +1,2 @@
import "./module-x";
import(/* webpackChunkName: "a" */"./module-a");

View File

@ -0,0 +1,2 @@
import "./module-x";
import(/* webpackChunkName: "c" */"./module-c");

View File

@ -0,0 +1,26 @@
chunk {0} 0.js (y) 0 bytes {4} {5} [rendered]
[1] (webpack)/test/statsCases/graph-correctness-modules/module-y.js 0 bytes {0} [built]
import() ./module-y [0] (webpack)/test/statsCases/graph-correctness-modules/module-x.js 1:0-47
chunk {1} 1.js (c) 49 bytes {3} {4} [rendered]
[3] (webpack)/test/statsCases/graph-correctness-modules/module-c.js 49 bytes {1} [built]
import() ./module-c [5] (webpack)/test/statsCases/graph-correctness-modules/module-b.js 1:0-47
import() ./module-c [6] (webpack)/test/statsCases/graph-correctness-modules/e2.js 2:0-47
chunk {2} 2.js (a) 49 bytes {1} {5} [rendered]
[2] (webpack)/test/statsCases/graph-correctness-modules/module-a.js 49 bytes {2} [built]
import() ./module-a [3] (webpack)/test/statsCases/graph-correctness-modules/module-c.js 1:0-47
import() ./module-a [4] (webpack)/test/statsCases/graph-correctness-modules/e1.js 2:0-47
chunk {3} 3.js (b) 179 bytes {2} [rendered]
[5] (webpack)/test/statsCases/graph-correctness-modules/module-b.js 179 bytes {3} [built]
import() ./module-b [2] (webpack)/test/statsCases/graph-correctness-modules/module-a.js 1:0-47
chunk {4} e2.js (e2) 119 bytes [entry] [rendered]
[0] (webpack)/test/statsCases/graph-correctness-modules/module-x.js 49 bytes {4} {5} [built]
harmony import ./module-x [4] (webpack)/test/statsCases/graph-correctness-modules/e1.js 1:0-20
import() ./module-x [5] (webpack)/test/statsCases/graph-correctness-modules/module-b.js 2:0-20
harmony import ./module-x [6] (webpack)/test/statsCases/graph-correctness-modules/e2.js 1:0-20
[6] (webpack)/test/statsCases/graph-correctness-modules/e2.js 70 bytes {4} [built]
chunk {5} e1.js (e1) 119 bytes [entry] [rendered]
[0] (webpack)/test/statsCases/graph-correctness-modules/module-x.js 49 bytes {4} {5} [built]
harmony import ./module-x [4] (webpack)/test/statsCases/graph-correctness-modules/e1.js 1:0-20
import() ./module-x [5] (webpack)/test/statsCases/graph-correctness-modules/module-b.js 2:0-20
harmony import ./module-x [6] (webpack)/test/statsCases/graph-correctness-modules/e2.js 1:0-20
[4] (webpack)/test/statsCases/graph-correctness-modules/e1.js 70 bytes {5} [built]

View File

@ -0,0 +1 @@
import(/* webpackChunkName: "b" */"./module-b");

View File

@ -0,0 +1,2 @@
import(/* webpackChunkName: "c" */"./module-c");
import("./module-x"); // This should not create a chunk, because module-x is in both entrypoints (in every path to this module-b)

View File

@ -0,0 +1 @@
import(/* webpackChunkName: "a" */"./module-a");

View File

@ -0,0 +1 @@
import(/* webpackChunkName: "y" */"./module-y");

View File

@ -0,0 +1,18 @@
module.exports = {
entry: {
e1: "./e1",
e2: "./e2"
},
output: {
filename: "[name].js"
},
stats: {
hash: false,
timings: false,
assets: false,
chunks: true,
chunkModules: true,
modules: false,
reasons: true
}
};