Differences between Angular compilations

288 Views Asked by At

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?

2

There are 2 best solutions below

0
Ulises 2010 On BEST ANSWER

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.

1
David On

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.