Toolkit: return original stack trace for webpack errors (#37814)

This commit is contained in:
Sergey Kostrukov 2021-08-14 13:49:56 -07:00 committed by GitHub
parent 5c69f899b5
commit 10cc9bda74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -57,17 +57,19 @@ export const bundlePlugin = async ({ watch, production, preserveConsole }: Plugi
} else {
compiler.run((err: Error, stats: webpack.Stats) => {
if (err) {
reject(err.message);
reject(err);
return;
}
if (stats.hasErrors()) {
stats.compilation.errors.forEach((e) => {
console.log(e.message);
});
reject('Build failed');
return;
}
console.log('\n', stats.toString({ colors: true }), '\n');
resolve();
});

View File

@ -11,7 +11,8 @@ export const useSpinner = async (label: string, fn: () => Promise<any>, killProc
if (err.stdout) {
console.error(err.stdout);
} else {
} else if (err.message) {
// Return stack trace if error object
console.trace(err); // eslint-disable-line no-console
}