Is there a way to dynamically generate lazy-loaded routes? I've been using the import syntax like this:
loadChildren: () => import(`./pages/${module.moduleName}/${module.moduleName}.module`).then(m => m[childModuleName]),
and it works with JIT, but throws an error with AOT:
ERROR Error: Uncaught (in promise): Error: Runtime compiler is not loaded
. The issue has been reported here: https://github.com/angular/angular-cli/issues/10582. The suggested solution is to switch back to the old string syntax:
loadChildren: `./pages/${module.moduleName/${module.moduleName}.module#${childModuleName}`,
But when I tried this, I encountered another error:
ERROR Error: Uncaught (in promise): Error: Cannot find module './pages/client-migration/client-migration.module.ngfactory'