im using Angular 6 and there are two ways of Lazy Loading modules in Angular:
First Method: Specify path to module as string
{path: 'debug', loadChildren: 'app/global/debug.module/debug.module#DebugModule'},
Second Methode: Specify module as Function Signature
{path: 'login', loadChildren: () => LoginMockModule},
In dev mode buth methods works, but in prod mode the second method gives me the following error:
ERROR Error: Uncaught (in promise): Error: Runtime compiler is not loaded Error: Runtime compiler is not loaded
Can someone explain why the second method doesn't work in prod mode. I'd like to use this mode because
- It is less error prone because the IDE can check if the Module is imported correctly
- It is save to refactor / move the module because the IDE knows that the imported module has moved.
Thanks for your help