角CLI

2017-08-08 50 views
0

我試圖使用的架構如下圖所示可選功能模塊:角CLI

module-name 
| 
+-- service 
| | pom.xml 
| | src 
+-- web 
| | *.ts 
+-- index.ts // barrell file 
webapp 
| 
+-- src 
| | app.module.ts 
| | main.ts 
| | tsconfig.app.json 
.angular-cli.json 
tsconfig.json 

如果tsconfig從.angular-cli.json設置爲webapp/src/tsconfig.app.json,使用ng serve作品如預期,但對於ng build --prod

它產生錯誤:

ERROR in /some_absolute_path/webapp/src/$$_gendir/module/web-utils/web/section/section.component.ngfactory.ts (13,21): Cannot find module './section.component'.

對於webapp/src每個文件。

另一方面,切換角度cli後使用./tsconfig.json AOT工作正常,但ng serve導致無盡的編譯。

+0

「將.angular-cli.json的tsconfig設置爲webapp/src/tsconfig.app.json」,嘗試將其更改爲'tsconfig.app.json'。可以工作! –

+0

不幸的是,它沒有。只需看看文件結構('tsconfig.app.json'在'webapp/src'內,而'.angular-cli.json'爲項目根目錄] – be4code

+0

它與普通的cli項目不同的地方是'tsconfig.app .json'位於'webapp'文件夾內的'src'文件夾內。在正常的cli應用程序中,它位於'src'中,'.angular-cli.json'具有'tsconfig:tsconfig.app.json'。顯然,這與它看起來的路徑有關。 –

回答

0

我建議創建具有

ng new app-name 

一個示例應用程序和配置和路徑比較生成的文件內。