woutdp / live_svelte

Svelte inside Phoenix LiveView with seamless end-to-end reactivity
https://hexdocs.pm/live_svelte
MIT License
1.28k stars 52 forks source link

Render is Broken from Svelte 5 #157

Open EricAndresen opened 2 days ago

EricAndresen commented 2 days ago

As of 0.14.1 on Linux I get this error when trying to render a Svelte component in a LiveView template.

Component.render(...) is no longer valid in Svelte 5. See https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes for more information
Error: Component.render(...) is no longer valid in Svelte 5. See https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes for more information
    at Counter.render (/home/erandre7/development/no_code_monitoring/app/priv/svelte/server.js:2167:9)
    at render2 (/home/erandre7/development/no_code_monitoring/app/priv/svelte/server.js:2193:22)
    at getResponse (/home/erandre7/development/no_code_monitoring/app/deps/nodejs/priv/server.js:54:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Interface.onLine (/home/erandre7/development/no_code_monitoring/app/deps/nodejs/priv/server.js:63:33)

Solved by downgrading to Svelte 4 with npm i svelte@4 in the assets folder.

woutdp commented 2 days ago

0.14.1 doesn't support Svelte 5 yet. 0.15.0 will be the version that supports Svelte 5

EricAndresen commented 2 days ago

To clarify I wasn't trying to install 5, I followed the instructions in the readme and Svelte 5 was installed, which crashed the application when I tried to run it. I think the npm scripts are installing Svelte 5 by default now that it's out of beta.

woutdp commented 2 days ago

Ah yes makes sense, I expect to release 0.15.0 soon so I'll leave it broken for now

EricAndresen commented 2 days ago

Excited for the next release!