fix(v2/templates): migrate svelte templates to the Svelte 5 mount API - #6012
fix(v2/templates): migrate svelte templates to the Svelte 5 mount API#6012haoku123 wants to merge 1 commit into
Conversation
The v2 svelte and svelte-ts templates pin svelte ^5.55.7 but still
bootstrap via the Svelte 4 component API (new App({ target })),
which was removed in Svelte 5. A freshly scaffolded project builds
but renders a blank page with a runtime console error.
Migrate both templates to mount(App, { target }), matching the
v3 svelte template, and add a changelog entry.
Fixes wailsapp#6001
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughBoth v2 Svelte templates now initialize applications with Svelte 5’s ChangesSvelte 5 bootstrap
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change updates the v2 Svelte templates to use the Svelte 5 mounting API, preventing blank-page runtime behavior in newly generated projects; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
Fixes #6001
The v2
svelteandsvelte-tstemplates pinsvelte: ^5.55.7(Svelte 5), but their generatedmain.js/main.tsstill bootstrap the app with the Svelte 4 component instantiation API:This API was removed in Svelte 5 in favor of
mount(). A freshly scaffolded project (wails init -t svelte-ts) builds and runs but renders a blank page, with a runtime error in the browser console.Solution
Migrate both templates to the Svelte 5
mount()API, matching what the v3 svelte template already does:For the TS template,
targetis cast toHTMLElementsincegetElementByIdreturnsHTMLElement | null.Changes
v2/pkg/templates/templates/svelte/frontend/src/main.jsv2/pkg/templates/templates/svelte-ts/frontend/src/main.ts[Unreleased]inwebsite/src/pages/changelog.mdxVerification
new App()bootstrap; v3's svelte template already usesmount(), confirming the correct API.new Component({ target })in favor ofmount()(see Svelte 5 migration guide).Summary by CodeRabbit
Bug Fixes
Documentation