Differences between Angular compilations

时间秒杀一切 提交于 2020-08-09 17:51:07

问题


When I compile my app with

ng build --prod

I have this error

ERROR in : Cannot determine the module for class AppComponent in D:/desarrollos/PatientPortal/front/src/app/customizations/database/app.component-database.ts! Add AppComponent to the NgModule to fix it.

but if it compile with

ng build --configuration=prod

It's compile ok and my app works ok.

I see the difference is the first one is compile with the AOT option, but I don't know why have this error, and don't know if it is important (maybe is about an extended class I have, but is important to me). Can you help me?


回答1:


Angular normally complains when you declare a component that is not part of any module.

If you just want to modify the default AppComponent html template at build time, you can just create a separate html template and use fileReplacements feature from angular.json.




回答2:


I found help In the github repository:

https://github.com/angular/angular/issues/38070

In my case, I'm trying to compile and abstract class using @Component decorator insteed @Directive decorator.



来源:https://stackoverflow.com/questions/62590862/differences-between-angular-compilations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!