Svelte 5 Migration Guide
Svelte 5 Migration Guide
Overview
Complete guide for migrating Svelte 4 applications to Svelte 5. Covers breaking changes, codemods, and incremental adoption strategies.
Breaking Changes Summary
| Area | Svelte 4 | Svelte 5 |
|---|---|---|
| Reactivity | Compiler-driven ($:) | Runes ($state, $derived, $effect) |
| Props | export let | $props() |
| Slots | <slot> | Snippets ({#snippet}, {@render}) |
| Events | on:click | onclick |
| Context | setContext/getContext | Still works, but $state modules preferred |
| Dispatch | createEventDispatcher | Callback props |
Automated Migration
1. Run the Official Codemod
npx @sveltejs/migrate@latest svelte-5
This handles: