Performance: Lazy Loading, Bundle Optimization, Memory Leaks and Production Builds
Learn Performance: Lazy Loading, Bundle Optimization, Memory Leaks and Production Builds (Phase 12 · Security and Performance (Production), Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Bundle optimisation • Measure first: ng build --stats-json and a visualiser ( esbuild-visualizer , source-map-explorer ), Lighthouse and Chrome DevTools. Watch Core Web Vitals (LCP, INP, CLS). • Lazy-load routes ( loadComponent / loadChildren ), defer heavy widgets with @defer , import only what you use (RxJS operators from 'rxjs' , individual lodash functions, date-fns instead of moment), avoid pulling large libraries into the main bundle. • Budgets in angular.json fail the build when bundles grow. Use NgOptimizedImage ( ngSrc , priority ) for images, compress with Brotli, cache hashed files...