2017-06-19 75 views
0

我有一個項目,使用--prod構建時可以很好地構建和運行EXCEPT。隨着分支更新app.module.ts添加一個新的類。使用--prod編譯時,錯誤似乎表明它沒有看到app.module.ts中的更新將新類包含在導入中。Angular2在使用prod模式時出現編譯錯誤

我已經做了一些尋找,雖然我看到提到斷言編譯時被忽略--prod我無法弄清楚爲什麼我得到不同的編譯結果。

建議在哪裏看?接收到的錯誤如下所示。如上所述 - 不使用--prod開關時不會發生此錯誤。

[email protected]:~/src/mazarbul$ ng build --prod 
Hash: df9a28c95c9046c1a94c                
Time: 22208ms 
chunk {0} main.fa72ef2ee5f706de666c.bundle.js (main) 1.46 kB {2} [initial] [rendered] 
chunk {1} styles.c5b565451a586f1a4277.bundle.css (styles) 69 bytes {3} [initial] [rendered] 
chunk {2} vendor.b736603c27f47849d40c.bundle.js (vendor) 1.08 MB [initial] [rendered] 
chunk {3} inline.09dee9cfb318b8246b24.bundle.js (inline) 0 bytes [entry] [rendered] 

ERROR in Cannot determine the module for class DialogComponent in /home/efultz/src/mazarbul/src/app/dialog/components/dialog.component.ts! Add DialogComponent to the NgModule to fix it. 

ERROR in ./src/main.ts 
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/home/efultz/src/mazarbul/src' 
@ ./src/main.ts 5:0-74 
@ multi ./src/main.ts 
+0

是包含在模塊中的DialogComponent?錯誤與該組件有關 –

回答

0

我發現我是能夠消除dialog.component.ts和問題走了 - 和原來,模塊必須已經從早期迭代的殘餘。仍然不明白爲什麼dev會工作,prod會失敗。