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

pull/37910/head
Sergey Kostrukov 4 years ago committed by GitHub
parent 5c69f899b5
commit 10cc9bda74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      packages/grafana-toolkit/src/cli/tasks/plugin/bundle.ts
  2. 3
      packages/grafana-toolkit/src/cli/utils/useSpinner.ts

@ -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();
});

@ -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
}

Loading…
Cancel
Save