From 3b583a8da2786287131aa882700d830eb94ec4e6 Mon Sep 17 00:00:00 2001 From: Chris Goller Date: Thu, 20 Oct 2016 15:08:45 -0500 Subject: [PATCH] Fix webpack exit code to actually work. Webpack does not return non-zero values are failure. This breaks most build systems. --- ui/webpack/prodConfig.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui/webpack/prodConfig.js b/ui/webpack/prodConfig.js index 4e1d8ca56..f57e7e3da 100644 --- a/ui/webpack/prodConfig.js +++ b/ui/webpack/prodConfig.js @@ -7,6 +7,7 @@ var package = require('../package.json'); var dependencies = package.dependencies; var config = { + bail: true, devtool: 'hidden-source-map', entry: { app: path.resolve(__dirname, '..', 'src', 'index.js'), @@ -91,6 +92,16 @@ var config = { new webpack.optimize.CommonsChunkPlugin({ names: ['vendor', 'manifest'], }), + function() { /* Webpack does not exit with non-zero status if error. */ + this.plugin("done", function(stats) { + if (stats.compilation.errors && stats.compilation.errors.length && process.argv.indexOf("--watch") == -1) { + console.log(stats.compilation.errors.toString({ + colors: true + })); + process.exit(1); + } + }); + } ], postcss: require('./postcss'), target: 'web',