Problem I have an Content Management System Angular application where all components are present in main component. Routes are created dynamically for this components (at runtime).
E.g. a page is created with name A, then dynamically a route can be created with a path :sname/route/to/pageA which displays the component (sname is the domain name).
This process works fine but all the components need to be in the main bundle for this to work.
As the app is growing bigger lazy loading becomes more and more necessary. Is there any possible way to create this kind of lazy loading components dynamically? I imagine that all of the components that can be dynamically added to routes need to have their own lazy loaded module. What I am now missing is how these modules are integrated with dynamic routes (which are only known at runtime) to the lazy loading process.
I am not necessarily looking for exact source code but also any pointers to potential approaches/similar projects would be incredibly helpful.
We have tried traditional route based lazy loading but it is not working, since the routes are dynamic. Also the libraries for lazy loading of components are not working, as we are using dynamic routing and can't predict which components will be used and those libraries load a component based on the action eg. click, hover etc.