0Pricing
Sveltejs Academy · Lesson

Lazy Loading Components

Defer non-critical component rendering with dynamic imports and intersection observers.

Why Lazy Load

Defer loading of heavy or non-critical components to reduce initial bundle size.

Dynamic Import

Use import() to load a module asynchronously.

let Component;
onMount(async () => {
  Component = (await import("./Heavy.svelte")).default;
});

All lessons in this course

  1. Code Splitting and Dynamic Imports
  2. Optimizing Images with @sveltejs/enhanced-img
  3. Lazy Loading Components
  4. Profiling SvelteKit Apps
← Back to Sveltejs Academy