Legacy reactive statements are not allowed in components using runes – mixing $: with $state in Svelte 5
0 reputation · 10 Apr 2022, 05:52 UTC
The goal is to migrate a component to Svelte 5’s runes reactivity gradually, keeping existing legacy reactive statements ($:) for parts of the logic that are not yet converted, while using $state, $derived, or $effect for new features.
However, the Svelte 5 compiler emits the error “Legacy reactive statements are not allowed in components using runes” when both syntaxes appear in the same file, blocking a piecemeal approach. It is unclear whether a compiler flag or future release will relax this restriction, or if the only supported path is to extract legacy logic into a separate child component.
- Is there a compiler option to permit legacy
$:statements in runes‑mode components for incremental migration? - Does Svelte provide a built‑in way to isolate legacy reactive logic without creating an extra child component?
- Are there plans to allow coexistence of
$:and runes in a future Svelte 5.x release?