Angular : Error: Uncaught (in promise) at webpackAsyncContext (eval at ./src/$$_lazy_route_resource

后端 未结 10 683
独厮守ぢ
独厮守ぢ 2020-12-14 15:32

I\'m upgrading from Angular 4.0.0 to Angular 5.2.6

i\'m facing some problem to get lazy module loading working.

with

10条回答
  •  情深已故
    2020-12-14 15:46

    ng service --aot while it compiles your code, is not a solution, it's just a coverup. If you determined that it was not the CLI version try the below solution.

    What you need to do is make sure in your app.module.ts you are not loading your lazy loaded module.

    For instance:

    app.module.ts
     imports: [
       ...
       AppRouterModule,
       FormsModule,
       YourFeatureModule, <--- remove this
       ...
     ]
    

    Make sure YourFeatureMOdule is being loaded via the routes ie:

    app-routing.module.ts
     loadChildren: '../app/feature.module#YourFeatureModule'
    

    Hope this helps

提交回复
热议问题