Skip to content

Commit 6689539

Browse files
committed
migrate missed watchClose hook
1 parent 0ccc037 commit 6689539

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lib/MultiCompiler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ module.exports = class MultiCompiler extends Tapable {
1515
super();
1616
this.hooks = {
1717
done: new SyncHook(["stats"]),
18-
invalid: new SyncHook([])
18+
invalid: new SyncHook([]),
19+
watchClose: new SyncHook([])
1920
};
2021
if(!Array.isArray(compilers)) {
2122
compilers = Object.keys(compilers).map((name) => {

lib/MultiWatching.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MultiWatching {
2222
asyncLib.forEach(this.watchings, (watching, finishedCallback) => {
2323
watching.close(finishedCallback);
2424
}, err => {
25-
this.compiler.applyPlugins("watch-close");
25+
this.compiler.hooks.watchClose.call();
2626
callback(err);
2727
});
2828

test/MultiWatching.unittest.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use strict";
22

3-
const Tapable = require("tapable-old");
3+
const Tapable = require("tapable").Tapable;
4+
const SyncHook = require("tapable").SyncHook;
45
require("should");
56
const sinon = require("sinon");
67
const MultiWatching = require("../lib/MultiWatching");
@@ -14,9 +15,11 @@ const createWatching = function() {
1415

1516
const createCompiler = () => {
1617
const compiler = {
17-
_plugins: {}
18+
hooks: {
19+
watchClose: new SyncHook([])
20+
}
1821
};
19-
Tapable.mixin(compiler);
22+
Tapable.addCompatLayer(compiler);
2023
return compiler;
2124
};
2225

0 commit comments

Comments
 (0)