【发布时间】:2017-12-05 20:34:39
【问题描述】:
我在多个 Git 存储库之间拆分了我的项目,现在我遇到了延迟加载问题
如果我使用以下语法将源代码从子仓库复制到主仓库
{
path: 'child-app',
loadChildren: './shared/child/src/app/child-app.module#ChildAppModule'
},
我可以毫无问题地构建和服务我的项目 但是,如果我将 Route 更改为指向 node_modules,如下所示
{
path: 'child-app',
loadChildren: '@mine/child/src/app/child-app.module#ChildAppModule'
},
或
{
path: 'child-app',
loadChildren: '../../node_modules/@mine/child/src/app/child-app.module#ChildAppModule'
},
它会引发这个错误:
ERROR in ./src/$$_gendir lazy
Module not found: Error: Can't resolve '/Users/myuser/Projects/web-app
/src/node_modules/@mine/child/src/app/child-app.module.module.ngfact
ory.ts' in '/Users/myuser/Projects/web-app/src/$$_gendir'
@ ./src/$$_gendir lazy
@ ./~/@angular/core/@angular/core.es5.js
@ ./src/main.browser.ts
@ multi ./src/main.browser.ts webpack-hot-middleware/client?path=/__webpa
ck_hmr&timeout=2000&reload=true&noInfo=true
我正在使用 webpack 2 和 ngtools/webpack 来编译我的项目
【问题讨论】:
-
仅供参考:貌似是buggithub.com/angular/angular-cli/issues/5986
标签: angular webpack lazy-loading webpack-2