The current Svelte version does it at build/compile time. The up and coming Svelte 5 is using signals and the reactivity is moved to runtime
11 karma · joined November 14, 2022
$:{ let name = 'world'; };
vs
let name = $state('world');
$: is valid javascript right? So that should also work in .js/.ts files I assume
I'm just brainstorming here, but what about an optional $reactive rune where everything in that is reactive by default?
$reactive(() => { let name = 'world'; });
vs
let name = $state('world');
What if it is opt-out reactivity in .svelte files and opt-in reactivity in .ts/.js files? Yeah I know it would be a bit more combersome to copy code from .svelte to .js/.ts files but I think it would be worth it