webpack-fail-plugin
Version:
Webpack plugin that makes the process return an error code on failure
17 lines (14 loc) • 379 B
JavaScript
module.exports = function() {
var isWatch = true;
this.plugin("run", function(compiler, callback) {
isWatch = false;
callback.call(compiler);
});
this.plugin("done", function(stats) {
if (stats.compilation.errors && stats.compilation.errors.length && !isWatch) {
process.on('beforeExit', function() {
process.exit(1);
});
}
});
};