Lazy load Angular 5 error: $$_lazy_route_resource lazy recursive

后端 未结 9 1998
傲寒
傲寒 2020-12-29 20:20

I\'m using angular cli AoT compilation. When I try to make a lazy load component following this tutorial, I got the error below:

ERROR Error         


        
相关标签:
9条回答
  • 2020-12-29 20:53

    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.

    0 讨论(0)
  • 2020-12-29 20:54

    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.

    0 讨论(0)
  • 2020-12-29 21:03

    I got the same issue.fix it by using

     {path:'listes' ,loadChildren: ()=>ListModule} not {path:'listes' ,loadChildren: 'app/component/list/list.module#ListModule'}
    
    0 讨论(0)
  • 2020-12-29 21:03

    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

    0 讨论(0)
  • 2020-12-29 21:03

    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

    0 讨论(0)
  • 2020-12-29 21:05

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

    0 讨论(0)
提交回复
热议问题