From a5274bbba8794c0a214029f8b2f982501d577b2b Mon Sep 17 00:00:00 2001 From: rdunk Date: Thu, 2 Jan 2025 19:05:39 +0000 Subject: [PATCH 1/2] fix: allow whitespace in legacy onMount check --- packages/kit/src/runtime/client/state.svelte.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 = { From 473a955a45e56342eb4b52523a68f294e33b1eac Mon Sep 17 00:00:00 2001 From: rdunk Date: Thu, 2 Jan 2025 19:10:15 +0000 Subject: [PATCH 2/2] chore: add changeset --- .changeset/cuddly-melons-taste.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/cuddly-melons-taste.md 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