Fix webpack exit code to actually work.

Webpack does not return non-zero values are failure.  This breaks
most build systems.
pull/260/head
Chris Goller 2016-10-20 15:08:45 -05:00
parent 984c3efaef
commit 3b583a8da2
1 changed files with 11 additions and 0 deletions

View File

@ -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',