Skip to main content

Bundles, lazy loading, @defer and images

Learn Bundles, lazy loading, @defer and images (Module 18 · Angular Performance Optimization, Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Ship less code, ship it later The smaller the JavaScript the browser must download and run, the faster the first screen. Think of packing for a trip: carry only what you need now. • Lazy loading and route-level code splitting : each lazy route ( loadComponent / loadChildren ) becomes a separate file downloaded when the user visits it. • Tree shaking : the build removes code nobody imports. Import from specific packages, not whole barrels, and prefer ES modules. • Production builds : ng build uses production configuration by default (AOT, minification, dead-code elimination, hashed file names,...

More lessons in Module 18 · Angular Performance Optimization