Просмотр исходного кода

chore: show errors and warnings on compilation

Gerald 8 лет назад
Родитель
Сommit
903a935556
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      gulpfile.js

+ 8 - 1
gulpfile.js

@@ -29,9 +29,16 @@ const paths = {
 
 function webpackCallback(err, stats) {
   if (err) {
-    gutil.log('[ERROR]', err);
+    gutil.log('[FATAL]', err);
     return;
   }
+  if (stats.hasErrors()) {
+    gutil.log('[ERROR] webpack compilation failed\n', stats.toJson().errors.join('\n'));
+    return;
+  }
+  if (stats.hasWarnings()) {
+    gutil.log('[WARNING] webpack compilation has warnings\n', stats.toJson().warnings.join('\n'));
+  }
   stats.stats.forEach(stat => {
     const timeCost = (stat.endTime - stat.startTime) / 1000;
     const chunks = Object.keys(stat.compilation.namedChunks).join(' ');