Skip to content

chore: upgrade to svelte v5 with fix demo app#221

Merged
Tony133 merged 1 commit into
mainfrom
chore/upgrade-svelte-v5
Jul 13, 2026
Merged

chore: upgrade to svelte v5 with fix demo app#221
Tony133 merged 1 commit into
mainfrom
chore/upgrade-svelte-v5

Conversation

@Tony133

@Tony133 Tony133 commented Jul 12, 2026

Copy link
Copy Markdown
Member

Proposal:

  • Upgrades the example app to svelte@^5.0.0, and fixes everything that broke.

Changes

  • Svelte 5 dropped svelte/register (its CJS require-hook) and the compiler now only emits ESM, so .svelte files could no longer be require().

  • Added example/svelte-loader.mjs, a Node module customization hook (module.register()) that compiles .svelte files to server-side JS on the fly, keeping their original file URLs so relative imports between components keep resolving normally without a bundler.

  • example/worker.js also strips Svelte 5's hydration marker comments from SSR output (<!--[-->, <!--]-->), since Hotwire only ever swaps static HTML via Turbo and never hydrates client-side.

  • Demo app fixes (unrelated to Svelte, surfaced by testing it):

    • /ws now registered inside a nested plugin, fixing a boot-order race with @fastify/websocket that left the websocket connection stuck pending forever.
    • superheroes@4's API change (randomSuperhero() instead of .random()).
    • POST /message now redirects instead of returning JSON, satisfying Turbo Drive's requirement for its target="_top" form.
    • GET / now reuses an existing session cookie instead of always minting a new identity, fixing an inability to delete a message you had just created.
    • POST /message/:id/delete now responds with a turbo-stream on success, consistent with its own error paths and /toast/ack.

Note:

Comment thread example/worker.js Dismissed
Comment thread example/worker.js Dismissed
@Tony133
Tony133 marked this pull request as ready for review July 12, 2026 09:42
@Tony133
Tony133 requested a review from a team July 12, 2026 09:42
@Tony133 Tony133 changed the title chore: upgrade example to svelte v5, fix demo app wiring chore: upgrade example to svelte v5, fix demo app Jul 12, 2026
@Tony133 Tony133 changed the title chore: upgrade example to svelte v5, fix demo app chore: upgrade to svelte v5 with fix demo app Jul 12, 2026
@Tony133
Tony133 force-pushed the chore/upgrade-svelte-v5 branch from 86a6eba to a67a581 Compare July 12, 2026 09:51
@Tony133
Tony133 merged commit 1887ab2 into main Jul 13, 2026
17 checks passed
@Tony133
Tony133 deleted the chore/upgrade-svelte-v5 branch July 13, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants