Skip to content

Commit 18dd491

Browse files
author
Guillaume Chau
committed
fix(build): better error output
1 parent 4f0f657 commit 18dd491

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

index.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,28 @@ module.exports = (api, options) => {
3333
const onCompilationComplete = (err, stats) => {
3434
if (err) {
3535
// eslint-disable-next-line
36-
console.error(err);
36+
console.error(err.stack || err)
37+
if (err.details) {
38+
// eslint-disable-next-line
39+
console.error(err.details)
40+
}
3741
return
3842
}
39-
// eslint-disable-next-line
40-
console.log(formatStats(stats, options.outputDir, api));
43+
44+
if (stats.hasErrors()) {
45+
stats.toJson().errors.forEach(err => console.error(err))
46+
process.exitCode = 1
47+
}
48+
49+
if (stats.hasWarnings()) {
50+
stats.toJson().warnings.forEach(warn => console.warn(warn))
51+
}
52+
53+
try {
54+
// eslint-disable-next-line
55+
console.log(formatStats(stats, options.outputDir, api));
56+
} catch (e) {
57+
}
4158
}
4259

4360
if (args.watch) {

0 commit comments

Comments
 (0)