prefer early return for config.stats tests
This commit is contained in:
parent
9e62d9c1a9
commit
65d2153638
|
@ -77,27 +77,28 @@ class WebpackProcess extends ProcessWrapper {
|
|||
if (err) {
|
||||
return callback(errorMessage(err));
|
||||
}
|
||||
if (!config.stats || config.stats === 'none') {
|
||||
return callback();
|
||||
}
|
||||
try {
|
||||
if (config.stats && config.stats !== 'none') {
|
||||
this._log('info', 'writing file '+ ('.embark/stats.report').bold.dim);
|
||||
await writeFile(
|
||||
fs.dappPath('.embark/stats.report'),
|
||||
stats.toString(config.stats)
|
||||
);
|
||||
this._log('info', 'writing file ' + ('.embark/stats.json').bold.dim);
|
||||
await writeFile(
|
||||
fs.dappPath('.embark/stats.json'),
|
||||
JSON.stringify(stats.toJson(config.stats))
|
||||
);
|
||||
this._log('info', 'writing file '+ ('.embark/stats.report').bold.dim);
|
||||
await writeFile(
|
||||
fs.dappPath('.embark/stats.report'),
|
||||
stats.toString(config.stats)
|
||||
);
|
||||
this._log('info', 'writing file ' + ('.embark/stats.json').bold.dim);
|
||||
await writeFile(
|
||||
fs.dappPath('.embark/stats.json'),
|
||||
JSON.stringify(stats.toJson(config.stats))
|
||||
);
|
||||
if (stats.hasErrors()) {
|
||||
const errors = stats.toJson(config.stats).errors.join('\n');
|
||||
return callback(errors);
|
||||
}
|
||||
callback();
|
||||
} catch (e) {
|
||||
return callback(errorMessage(e));
|
||||
}
|
||||
if (config.stats && stats.hasErrors()) {
|
||||
const errors = stats.toJson(config.stats).errors.join('\n');
|
||||
return callback(errors);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue