【发布时间】:2021-02-03 19:39:19
【问题描述】:
我需要动态创建延迟加载的路由。当我使用导入语法时,例如loadChildren: () => import(`./pages/${module.moduleName}/${module.moduleName}.module`).then(m => m[childModuleName]), 它可以在 JIT 上运行,但是在 AOT 上运行时,会引发以下错误:
ERROR Error: Uncaught (in promise): Error: Runtime compiler is not loaded 根据 https://github.com/angular/angular-cli/issues/10582 解决方案是使用旧的字符串语法:
```` loadChildren:./pages/${module.moduleName/${module.moduleName}.module#${childModuleName},
I get this error:
``` ERROR Error: Uncaught (in promise): Error: Cannot find module './pages/client-migration/client-migration.module.ngfactory' ```
【问题讨论】:
标签: javascript angular typescript lazy-loading