Skip to content

Commit ccc32d3

Browse files
committed
Remove unnecessary handler wrapper
1 parent ea6e173 commit ccc32d3

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lib/MultiCompiler.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,10 @@ module.exports = class MultiCompiler extends Tapable {
189189
watch(watchOptions, handler) {
190190
if (this.running) return handler(new ConcurrentCompilationError());
191191

192-
const finalHandler = (err, stats) => {
193-
this.running = false;
194-
195-
if (handler !== undefined) handler(err, stats);
196-
};
197-
198192
let watchings = [];
199193
let allStats = this.compilers.map(() => null);
200194
let compilerStatus = this.compilers.map(() => false);
201-
if (this.validateDependencies(finalHandler)) {
195+
if (this.validateDependencies(handler)) {
202196
this.running = true;
203197
this.runWithDependencies(
204198
this.compilers,
@@ -210,7 +204,7 @@ module.exports = class MultiCompiler extends Tapable {
210204
? watchOptions[compilerIdx]
211205
: watchOptions,
212206
(err, stats) => {
213-
if (err) finalHandler(err);
207+
if (err) handler(err);
214208
if (stats) {
215209
allStats[compilerIdx] = stats;
216210
compilerStatus[compilerIdx] = "new";
@@ -220,7 +214,7 @@ module.exports = class MultiCompiler extends Tapable {
220214
});
221215
compilerStatus.fill(true);
222216
const multiStats = new MultiStats(freshStats);
223-
finalHandler(null, multiStats);
217+
handler(null, multiStats);
224218
}
225219
}
226220
if (firstRun && !err) {

0 commit comments

Comments
 (0)