Skip to content

Commit fda6167

Browse files
committed
catching errors in webpack
1 parent 2a95ffd commit fda6167

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

gulpfile.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ var eslint = require('gulp-eslint');
66
var each = require('gulp-each');
77
var fc2json = require('gulp-file-contents-to-json');
88
var log = require('fancy-log');
9-
var PluginError = require('plugin-error');
109
var exec = require('child_process').exec;
1110
const fs = require('fs');
1211

@@ -37,19 +36,29 @@ gulp.task('buildNode', function () {
3736
gulp.task('buildBrowser', function (callback) {
3837
webpack(require('./webpack.config.js'), function (err, stats) {
3938
if (err) {
40-
throw new PluginError("webpack", err);
39+
callback(err);
40+
return;
4141
}
4242
log("[webpack]", stats.toString({}));
43+
if (stats.compilation.errors && stats.compilation.errors.length) {
44+
callback(stats.compilation.errors);
45+
return;
46+
}
4347
callback();
4448
});
4549
});
4650

4751
gulp.task('buildWithStandardFonts', function (callback) {
4852
webpack(require('./webpack-standardfonts.config.js'), function (err, stats) {
4953
if (err) {
50-
throw new PluginError("webpack", err);
54+
callback(err);
55+
return;
5156
}
5257
log("[webpack]", stats.toString({}));
58+
if (stats.compilation.errors && stats.compilation.errors.length) {
59+
callback(stats.compilation.errors);
60+
return;
61+
}
5362
callback();
5463
});
5564
});

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"gulp-file-contents-to-json": "^0.2.2",
2727
"gulp-spawn-mocha": "^5.0.1",
2828
"mocha": "^5.2.0",
29-
"plugin-error": "^1.0.1",
3029
"rewire": "^4.0.1",
3130
"sinon": "^7.2.3",
3231
"string-replace-webpack-plugin": "^0.1.3",

0 commit comments

Comments
 (0)