EXCEPTION: Uncaught (in promise): Error: Cannot find module 'app/home/home.module'

后端 未结 11 2494
遇见更好的自我
遇见更好的自我 2021-01-01 12:37

I\'m trying to lazy load Angular 2 modules with the router, and I\'m having this error:

error_handler.js:50 EXCEPTION: Uncaught (in promise): Error: C

11条回答
  •  一个人的身影
    2021-01-01 12:54

    It seems that the angular-cli renderer has problems with lazy loading when you use export default class SomeModule { } ...along with a few other nuances.

    This is what I did to resolve the same "Error: Cannot find module..." I was getting on Heroku deployment:

    • Source all loadChildren paths from the app root & include a hash for your module name
      • loadChildren: 'app/main/some-module/some-module.module#SomeModule'
    • Change export default class SomeModule { } to export class SomeModule { }

提交回复
热议问题