mirror of https://github.com/webpack/webpack.git
Remove unnecessary handler wrapper
This commit is contained in:
parent
ea6e173551
commit
ccc32d31bf
|
|
@ -189,16 +189,10 @@ module.exports = class MultiCompiler extends Tapable {
|
||||||
watch(watchOptions, handler) {
|
watch(watchOptions, handler) {
|
||||||
if (this.running) return handler(new ConcurrentCompilationError());
|
if (this.running) return handler(new ConcurrentCompilationError());
|
||||||
|
|
||||||
const finalHandler = (err, stats) => {
|
|
||||||
this.running = false;
|
|
||||||
|
|
||||||
if (handler !== undefined) handler(err, stats);
|
|
||||||
};
|
|
||||||
|
|
||||||
let watchings = [];
|
let watchings = [];
|
||||||
let allStats = this.compilers.map(() => null);
|
let allStats = this.compilers.map(() => null);
|
||||||
let compilerStatus = this.compilers.map(() => false);
|
let compilerStatus = this.compilers.map(() => false);
|
||||||
if (this.validateDependencies(finalHandler)) {
|
if (this.validateDependencies(handler)) {
|
||||||
this.running = true;
|
this.running = true;
|
||||||
this.runWithDependencies(
|
this.runWithDependencies(
|
||||||
this.compilers,
|
this.compilers,
|
||||||
|
|
@ -210,7 +204,7 @@ module.exports = class MultiCompiler extends Tapable {
|
||||||
? watchOptions[compilerIdx]
|
? watchOptions[compilerIdx]
|
||||||
: watchOptions,
|
: watchOptions,
|
||||||
(err, stats) => {
|
(err, stats) => {
|
||||||
if (err) finalHandler(err);
|
if (err) handler(err);
|
||||||
if (stats) {
|
if (stats) {
|
||||||
allStats[compilerIdx] = stats;
|
allStats[compilerIdx] = stats;
|
||||||
compilerStatus[compilerIdx] = "new";
|
compilerStatus[compilerIdx] = "new";
|
||||||
|
|
@ -220,7 +214,7 @@ module.exports = class MultiCompiler extends Tapable {
|
||||||
});
|
});
|
||||||
compilerStatus.fill(true);
|
compilerStatus.fill(true);
|
||||||
const multiStats = new MultiStats(freshStats);
|
const multiStats = new MultiStats(freshStats);
|
||||||
finalHandler(null, multiStats);
|
handler(null, multiStats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (firstRun && !err) {
|
if (firstRun && !err) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue