Merge pull request #11499 from webpack/bugfix/snapshot-iterable

fix incorrect iteration
This commit is contained in:
Tobias Koppers 2020-09-20 22:12:22 +02:00 committed by GitHub
commit b85bc6e731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 41 additions and 1 deletions

View File

@ -316,8 +316,8 @@ class Snapshot {
const result = it.next();
if (!result.done) return result;
state = 0;
break;
}
/* falls through */
case 2: {
const children = snapshot.children;
if (children !== undefined) {

View File

@ -0,0 +1,3 @@
import "./loader!package";
it("should compile and run the test in config", () => {});

View File

@ -0,0 +1,6 @@
const path = require("path");
module.exports = function (source) {
this.addDependency(path.resolve(__dirname, "node_modules/package/extra.js"));
this.addDependency(path.resolve(__dirname, "extra.js"));
return source;
};

View File

@ -0,0 +1,4 @@
{
"name": "package",
"version": "1.0.0"
}

View File

@ -0,0 +1,27 @@
const path = require("path");
/** @type {import("../../../../").Configuration} */
module.exports = {
snapshot: {
managedPaths: [path.resolve(__dirname, "node_modules")]
},
plugins: [
compiler => {
compiler.hooks.done.tap("Test", ({ compilation }) => {
const fileDeps = Array.from(compilation.fileDependencies);
expect(fileDeps).toContain(
path.resolve(__dirname, "node_modules/package/index.js")
);
expect(fileDeps).toContain(
path.resolve(__dirname, "node_modules/package/extra.js")
);
expect(fileDeps).toContain(
path.resolve(__dirname, "node_modules/package/package.json")
);
expect(fileDeps).toContain(path.resolve(__dirname, "extra.js"));
expect(fileDeps).toContain(path.resolve(__dirname, "loader.js"));
expect(fileDeps).toContain(path.resolve(__dirname, "index.js"));
});
}
]
};