瀏覽代碼

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

Evan You 9 年之前
父節點
當前提交
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(