Explorar el Código

chore: show errors and warnings on compilation

Gerald hace 8 años
padre
commit
903a935556
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  1. 8 1
      gulpfile.js

+ 8 - 1
gulpfile.js

@@ -29,9 +29,16 @@ const paths = {
 
 
 function webpackCallback(err, stats) {
 function webpackCallback(err, stats) {
   if (err) {
   if (err) {
-    gutil.log('[ERROR]', err);
+    gutil.log('[FATAL]', err);
     return;
     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 => {
   stats.stats.forEach(stat => {
     const timeCost = (stat.endTime - stat.startTime) / 1000;
     const timeCost = (stat.endTime - stat.startTime) / 1000;
     const chunks = Object.keys(stat.compilation.namedChunks).join(' ');
     const chunks = Object.keys(stat.compilation.namedChunks).join(' ');