1 parent 60a5edc commit 44e02f4Copy full SHA for 44e02f4
1 file changed
lib/Watching.js
@@ -166,9 +166,12 @@ class Watching {
166
}
167
168
close(callback) {
169
- if (callback === undefined) callback = () => {};
+ const finalCallback = () => {
170
+ this.compiler.hooks.watchClose.call();
171
+ this.compiler.running = false;
172
+ if (callback !== undefined) callback();
173
+ };
174
- this.compiler.running = false;
175
this.closed = true;
176
if (this.watcher) {
177
this.watcher.close();
@@ -180,13 +183,9 @@ class Watching {
180
183
181
184
if (this.running) {
182
185
this.invalid = true;
- this._done = () => {
- this.compiler.hooks.watchClose.call();
- callback();
186
- };
+ this._done = finalCallback;
187
} else {
188
189
+ finalCallback();
190
191
192
0 commit comments