I am using a custom attribute solution and a dynamic component creation in order to create components dynamically. The component is decorated with a custom attribute and then looked up in a dictionary at runtime. Such components have to be referenced in the module with entryComponents
. This is working fine in dev mode but as soon as I try production, it no longer works.
There are no errors/warning in the build process either. Things just stop working. There is a @deprecated
comment for entryComponents
telling that it is no longer necessary but apparently not wrong to use.
Even if I move the entryComponents
into the app.module.ts
, the prod mode still fails. How can I make this work? I am happy to use other methods as long as I can reference components by name at runtime.
I have created a demo that reproduces the problem along with a git repository. Please note that merely doing enableProdMode()
in StackBlitz will not demonstrate the issue. You have to do the "--prod" which I am not sure StackBlitz can do.
When running the app with ng serve
all is fine but trying the production mode with ng serve --prod
makes the app behave differently.