From ea6b00b67d0dd18ed09cff6c20e574395c82120f Mon Sep 17 00:00:00 2001 From: jos Date: Fri, 26 Aug 2016 09:19:15 +0200 Subject: [PATCH] Fixed build script not outputting errors --- gulpfile.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 1aec6d0..9175b14 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -39,6 +39,7 @@ var compiler = webpack({ entry: ENTRY, devtool: 'source-map', debug: true, + bail: true, output: { library: 'jsoneditor', libraryTarget: 'umd', @@ -78,6 +79,19 @@ var compilerMinimalist = webpack({ cache: true }); +function handleCompilerCallback (err, stats) { + if (err) { + gutil.log(err.toString()); + } + + if (stats && stats.compilation && stats.compilation.errors) { + // output soft errors + stats.compilation.errors.forEach(function (err) { + gutil.log(err.toString()); + }); + } +} + // make dist folder gulp.task('mkdir', function () { mkdirp.sync(DIST); @@ -89,9 +103,7 @@ gulp.task('bundle', ['mkdir'], function (done) { bannerPlugin.banner = createBanner(); compiler.run(function (err, stats) { - if (err) { - throw new gutil.PluginError('webpack', err); - } + handleCompilerCallback(err, stats) gutil.log('bundled ' + NAME + '.js'); @@ -105,9 +117,7 @@ gulp.task('bundle-minimalist', ['mkdir'], function (done) { bannerPlugin.banner = createBanner(); compilerMinimalist.run(function (err, stats) { - if (err) { - throw new gutil.PluginError('webpack', err); - } + handleCompilerCallback(err, stats) gutil.log('bundled ' + NAME_MINIMALIST + '.js');