diff --git a/.changeset/cuddly-melons-taste.md b/.changeset/cuddly-melons-taste.md new file mode 100644 index 000000000000..830bbd66d5f1 --- /dev/null +++ b/.changeset/cuddly-melons-taste.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +fix: allow whitespace in legacy onMount check diff --git a/packages/kit/src/runtime/client/state.svelte.js b/packages/kit/src/runtime/client/state.svelte.js index 5e1978869ca3..904be39bd0c6 100644 --- a/packages/kit/src/runtime/client/state.svelte.js +++ b/packages/kit/src/runtime/client/state.svelte.js @@ -12,7 +12,7 @@ export let updated; // this is a bootleg way to tell if we're in old svelte or new svelte const is_legacy = - onMount.toString().includes('$$') || /function \w+\(\) \{\}/.test(onMount.toString()); + onMount.toString().includes('$$') || /function \w+\(\) \{\s?\}/.test(onMount.toString()); if (is_legacy) { page = {