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 { } else {
compiler.run((err: Error, stats: webpack.Stats) => { compiler.run((err: Error, stats: webpack.Stats) => {
if (err) { if (err) {
reject(err.message); reject(err);
return; return;
} }
if (stats.hasErrors()) { if (stats.hasErrors()) {
stats.compilation.errors.forEach((e) => { stats.compilation.errors.forEach((e) => {
console.log(e.message); console.log(e.message);
}); });
reject('Build failed'); reject('Build failed');
return;
} }
console.log('\n', stats.toString({ colors: true }), '\n'); console.log('\n', stats.toString({ colors: true }), '\n');
resolve(); resolve();
}); });

View File

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