Closed mmailaender closed 6 months ago
This bug is caused by faulty hoisting logic. Here's a simpler repro:
<script>
const store = {};
function foo() {
store;
$store;
}
function bar() {
store;
$store;
}
function baz(event) {
foo();
}
</script>
<button on:click={foo}>close</button>
<button on:click={bar}>confirm</button>
Output:
function bar(_, store, store, $store) {
store;
$store();
}
(An aside: interestingly, foo
isn't hoisted, even though it's only referenced by baz
, which could be hoisted but isn't, presumably because the hoisting logic never encounters it.)
To use Skeleton with Svelte5 before this issue is fixed, I created a Skeleton fork that works around this issue:
npm install 'https://gitpkg.now.sh/Leftium/skeleton/packages/skeleton?svelte-5-compat'
I simply commented out the line of code that was causing this issue. So the modal might be slightly broken when you hit the "Confirm" button.
This appears to be fixed in current versions
Describe the bug
Running
pnpm install
andpnpm dev
with Version5.0.0-next.12
With
4.2.7
everything works fine.Reproduction
https://github.com/mmailaender/svelte5
Logs
No response
System Info
Severity
blocking an upgrade