简体   繁体   English

Angular 8 - 获取运行时编译器未加载错误

[英]Angular 8 - Getting Runtime compiler not loaded error

I need to dynamically create lazy loaded routes.我需要动态创建延迟加载的路由。 When I use import syntax, eg loadChildren: () => import(`./pages/${module.moduleName}/${module.moduleName}.module`).then(m => m[childModuleName]), it works on JIT but when running on AOT, it throws this error: ERROR Error: Uncaught (in promise): Error: Runtime compiler is not loaded as per https://github.com/angular/angular-cli/issues/10582 the solution would be to use the old string syntax: ```` loadChildren: ./pages/${module.moduleName/${module.moduleName}.module#${childModuleName} ,当我使用导入语法时,例如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 as per 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' ```

将模块名称导入到 module.ts 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM