Indigosoft/ngxd

'NgModuleFactoryLoader' is deprecated.

Opened this issue · 2 comments

Now that NgModuleFactoryLoader is being deprecated what could be the right syntax for lazy loading our component modules?

Hey 👋 Yes, NgModuleFactoryLoader is now deprecated, so you need to use dynamic imports like here https://github.com/IndigoSoft/ngxd#3-lazy-loading-the-dynamic-component

Hi, @thekiba thank you for your answer. I'll give it a try, but I'm not sure how to face it, as I want to have my components in different lazy loaded modules, so I only load the specific component needed for each situation.
I tried creating lazy loaded modules and adding "fake" lazy loaded routes to the router in order to tell Angular which dependencies my components have. This works fine for components but doesn't load the services included in my component dependencies (angular material component providers). Also, with that approach i'm not able to really lazy load the code, as Angular prepares a single chunk I don't know why.
Maybe with your approach I'll be able to get a separated chunk as the dynamic components would be provided in the lazy loaded module that includes the resolver, but still don't know how to generate multiple chunks for each dynamic component using a single resolver