Performance: RouterModule configuration
MEDIUM IMPACT
This affects the initial page load speed and navigation responsiveness by controlling route setup and lazy loading.
imports: [RouterModule.forRoot([{ path: 'dashboard', loadChildren: () => import('./dashboard/dashboard.module').then(m => m.DashboardModule) }, { path: 'profile', loadChildren: () => import('./profile/profile.module').then(m => m.ProfileModule) }, { path: 'settings', loadChildren: () => import('./settings/settings.module').then(m => m.SettingsModule) }])]imports: [RouterModule.forRoot([{ path: 'dashboard', loadChildren: () => import('./dashboard/dashboard.module').then(m => m.DashboardModule) }, { path: 'profile', component: ProfileComponent }, { path: 'settings', component: SettingsComponent }])]| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Eager loading all routes | High (many components loaded upfront) | Multiple reflows during initial load | High paint cost due to large bundle | [X] Bad |
| Lazy loading feature modules | Low (only active route components loaded) | Single reflow per navigation | Lower paint cost, faster initial render | [OK] Good |