Permalink
Browse files

Improve error handling if webpack errors. (#1374)

It turns out webpack can error in two ways. This adds a check for the second way
and also surfaces any warnings.
See: https://webpack.js.org/api/node/#error-handling.
  • Loading branch information...
harrysarson authored and josdejong committed Jan 5, 2019
1 parent 4a0873a commit 1e2f3ed0d48497cd2248e6c6b7c9865a630346de
Showing with 11 additions and 0 deletions.
  1. +11 −0 gulpfile.js
@@ -107,6 +107,17 @@ function bundle (done) {
compiler.run(function (err, stats) {
if (err) {
gutil.log(err)
done(err)
}
const info = stats.toJson()

if (stats.hasWarnings()) {
gutil.log('Webpack warnings:\n' + info.warnings.join('\n'))
}

if (stats.hasErrors()) {
gutil.log('Webpack errors:\n' + info.errors.join('\n'))
done(new Error('Compile failed'))
}

gutil.log('bundled ' + MATH_JS)

0 comments on commit 1e2f3ed

Please sign in to comment.