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

avoid swallowing webpack error when entry is not found (fix #5553)

Evan You 9 лет назад
Родитель
Сommit
cab1b151e2
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      src/server/webpack-plugin/server.js

+ 8 - 1
src/server/webpack-plugin/server.js

@@ -13,7 +13,14 @@ export default class VueSSRServerPlugin {
     compiler.plugin('emit', (compilation, cb) => {
       const stats = compilation.getStats().toJson()
       const entryName = Object.keys(stats.entrypoints)[0]
-      const entryAssets = stats.entrypoints[entryName].assets.filter(isJS)
+      const entryInfo = stats.entrypoints[entryName]
+
+      if (!entryInfo) {
+        // #5553
+        return cb()
+      }
+
+      const entryAssets = entryInfo.assets.filter(isJS)
 
       if (entryAssets.length > 1) {
         throw new Error(