【发布时间】:2019-07-17 13:40:05
【问题描述】:
当我运行ng build --prod 时,未包含设置为延迟加载的新添加功能模块。但是,当使用ng serve 在本地运行时,它会被包含并正确加载。该项目使用 Angular 5.2.10。
我是 Angular 的新手,我不知道去哪里寻找配置问题。我已阅读以下内容:
- https://v5.angular.io/guide/lazy-loading-ngmodules
- https://v5.angular.io/guide/entry-components
- ng build does not include component class code of library modules
我还将新添加的功能模块与其他正确路由和捆绑的现有模块逐行进行了比较。我找不到任何明显的缺失。
这是功能模块的路径:
{
path: "admin/audit",
loadChildren: "app/features/audit/audit.module#AuditModule",
data: { title: "Audit Logs" }
},
以下是功能模块的路由模块内的路由:
const routes: Routes = [{
path: '',
component: AuditListComponent,
runGuardsAndResolvers: "paramsOrQueryParamsChange",
resolve: {
pageResult: AuditListResolverService
}
}];
我还应该检查哪些其他事项?
【问题讨论】:
标签: angular