From 36a93d6fcb1266b20d9c597ff77a3b870e8d910a Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Tue, 16 Jun 2020 08:21:07 -0700 Subject: [PATCH] Make sure webpack exits with non-zero status when there are errors. Fixes #115. --- generator/src/develop.js | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/generator/src/develop.js b/generator/src/develop.js index faf81bd3b..e297933a3 100644 --- a/generator/src/develop.js +++ b/generator/src/develop.js @@ -98,35 +98,35 @@ function run({ routes, manifestConfig }) { }) ).run((err, stats) => { if (err) { - console.error(err); + process.exit(1); + } else if (stats.compilation.errors && stats.compilation.errors.length > 0) { + console.error(stats.compilation.errors); process.exit(1); } else { - // done - } + console.log( + stats.toString({ + chunks: false, // Makes the build much quieter + colors: true, // Shows colors in the console + // copied from `'minimal'` + all: false, + modules: false, + performance: true, + timings: false, + outputPath: true, + maxModules: 0, + errors: true, + warnings: true, + // our additional options + moduleTrace: false, + errorDetails: false + }) + ); - console.log( - stats.toString({ - chunks: false, // Makes the build much quieter - colors: true, // Shows colors in the console - // copied from `'minimal'` - all: false, - modules: false, - performance: true, - timings: false, - outputPath: true, - maxModules: 0, - errors: true, - warnings: true, - // our additional options - moduleTrace: false, - errorDetails: false - }) - ); - - const duration = roundToOneDecimal( - (stats.endTime - stats.startTime) / 1000 - ); - console.log(`Duration: ${duration}s`); + const duration = roundToOneDecimal( + (stats.endTime - stats.startTime) / 1000 + ); + console.log(`Duration: ${duration}s`); + } }); }