Lazy loading Angular modules with Ivy

1 Like

Hi Andrei,

Thanks for the article. I tried to run the app in production mode (ng serve --prod) and load a module lazily. componentFctories returned in the following statement is empty.

this.componentFactories = moduleFactories.componentFactories;

It is not giving any errors. Any idea how to make it work in prod mode?

Thanks,
Rao

Hello Rao,
I’m glad you found the article useful. Unfortunately, it does not work in production mode. The optimizations that are run when built with the --prod flag strip away the information needed for this to work. I opened an issue for this, but I think this is how it is going to remain.

I will update the article to point this out.

Andrei

1 Like