Skip to content

Instantly share code, notes, and snippets.

View furic's full-sized avatar
🎮
Developing game with Pixi.js and Svelte

Richard Fu furic

🎮
Developing game with Pixi.js and Svelte
View GitHub Profile

Svelte Lazy Loading Components: Svelte 4 vs Svelte 5 (Runes)

Description

This gist demonstrates how to lazy load Svelte components using dynamic imports, comparing the syntax between Svelte 4 and Svelte 5 (runes mode). Lazy loading is a powerful technique to optimize bundle size and improve performance by loading components only when needed (e.g., widgets, modals, or rarely-used UI).


Svelte 4 Syntax