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

后端 未结 11 2492
遇见更好的自我
遇见更好的自我 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:43

    For me I had to use Module Map NgFactory Loader you can do:

    npm install @nguniversal/module-map-ngfactory-loader --save
    

    then add module-map-ngfactory-loader to your server module:

    import {ModuleMapLoaderModule} from '@nguniversal/module-map-ngfactory-loader';
    
    @NgModule({
      imports: [
        AppModule,
        ServerModule,
        ModuleMapLoaderModule
      ],
      bootstrap: [AppComponent],
    })
    export class AppServerModule {}
    

提交回复
热议问题