Merge pull request #12938 from animecyc/bugfix/blocked-multicompiler

fix: allow invalidation after first watch run
This commit is contained in:
Tobias Koppers 2021-03-19 22:15:50 +01:00 committed by GitHub
commit dd80303dc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 1 deletions

View File

@ -457,7 +457,7 @@ module.exports = class MultiCompiler {
node.compiler,
i,
nodeDone.bind(null, node),
() => node.state !== "running",
() => node.state !== "done" && node.state !== "running",
() => nodeChange(node),
() => nodeInvalid(node)
)

View File

@ -363,6 +363,41 @@ describe("MultiCompiler", function () {
}
});
});
it("shouldn't hang when invalidating watchers", done => {
const entriesA = { a: "./a.js" };
const entriesB = { b: "./b.js" };
const compiler = webpack([
{
name: "a",
mode: "development",
entry: () => entriesA,
context: path.join(__dirname, "fixtures")
},
{
name: "b",
mode: "development",
entry: () => entriesB,
context: path.join(__dirname, "fixtures")
}
]);
compiler.watchFileSystem = { watch() {} };
compiler.outputFileSystem = createFsFromVolume(new Volume());
const watching = compiler.watch({}, error => {
if (error) {
done(error);
return;
}
entriesA.b = "./b.js";
entriesB.a = "./a.js";
watching.invalidate(done);
});
}, 2000);
it("shouldn't hang when invalidating during build", done => {
const compiler = webpack(
Object.assign([