I recently upgraded a project to Angular 8, I've tried switching the loadChildren imports to the new syntax
For example from:
loadChildren: './maintenance/maintenance.module#MaintenanceModule',
To:
loadChildren:() => import('./maintenance/maintenance.module').then(m => m.MaintenanceModule),
The app-routing is created like so:
@NgModule({
imports: [
RouterModule.forRoot(appRoutes, {
scrollPositionRestoration: 'enabled',
enableTracing: false,
}),
],
exports: [RouterModule],
})
export class AppRoutingModule { }
However upon building the project no modules seem to be lazy loaded. Using Webpack bundle analyser I can see all the routed modules are included in the main bundle, and also no network activity is occurring when navigating to these routes.
Does anybody know what I'm missing here?