- import { NgModule, ModuleWithProviders } from '@angular/core';  
- import { Routes, RouterModule } from '@angular/router';  
- import { MainModule } from './main/main.module';  
- import { AuthModule } from './auth/auth.module';  
- const routes: Routes = [  
- {path: '', redirectTo: 'auth', pathMatch: 'full'},  
- {path: 'login' , redirectTo: 'auth' , pathMatch: 'full'},  
- {path: 'auth', loadChildren: () => AuthModule }  
- ];  
- @NgModule({  
- imports: [RouterModule.forRoot(routes)],  
- exports: [RouterModule],  
- })  
- export class AppRoutingModule { }  
It works with ng build but did not work with prod mode  'ng build --prod'