问题
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