Lazy load Angular 5 error: $$_lazy_route_resource lazy recursive

被刻印的时光 ゝ 提交于 2019-11-28 22:38:29
coderroggie

I cloned and reproduced the issue using your posted GitHub code. In order to fix, your @angular/cli global and devDependencies packages must be at 1.7.2

npm remove -g @angular/cli
npm install -g @angular/cli@1.7.2
npm remove @angular/cli
npm add @angular/cli@1.7.2 --save-dev

Now the @angular/cli package in your devDependencies matches the global version and it is set to 1.7.2 where that issue is resolved.

I got the same issue. I solve it Just stopping the cli server and start it. Error is gone if you done your code correctly.

There is an open bug on angular-cli 1.7.x: https://github.com/angular/angular-cli/issues/9488#issuecomment-368871510

Downgrade to 1.6.8 solve the issue for me.

Jor Jule

I got the same issue.fix it by using

 {path:'listes' ,loadChildren: ()=>ListModule} not {path:'listes' ,loadChildren: 'app/component/list/list.module#ListModule'}

Please see this comment on the 1.7.x bug. The issue seems to be importing the lazy loaded module into the AppModule. Removing that import fixed the issue for me: https://github.com/angular/angular-cli/issues/9488#issuecomment-374037802

As for me the problem was in importing ChildModule after AppRoutingModule in AppModule. Reordering them fixed my problem.

According to me the problem is that you may be lazy loading more than one module on same routes in same routing file. I also faced similar problem and change the name of one of the route

I had the same problem and managed to solve it by adding my lazy loaded modules to my angular CLI config file (angular.json). See my answer here: Angular 5 lazy loading Error: Cannot find module

In your app.module.ts, did you import ListModule ?

I faced same issue, and was able to fix it by removing lazy loaded modules from imports in app.module.ts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!