From b71ee6867bea4b20b87f6ae1845c3fe3fa0e3e4a Mon Sep 17 00:00:00 2001 From: haoku123 Date: Sun, 23 Aug 2026 01:04:09 +0800 Subject: [PATCH] fix(v2/templates): migrate svelte templates to the Svelte 5 mount API 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 #6001 --- v2/pkg/templates/templates/svelte-ts/frontend/src/main.ts | 5 +++-- v2/pkg/templates/templates/svelte/frontend/src/main.js | 3 ++- website/src/pages/changelog.mdx | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/v2/pkg/templates/templates/svelte-ts/frontend/src/main.ts b/v2/pkg/templates/templates/svelte-ts/frontend/src/main.ts index 95c41a51d20..3a65b849de7 100644 --- a/v2/pkg/templates/templates/svelte-ts/frontend/src/main.ts +++ b/v2/pkg/templates/templates/svelte-ts/frontend/src/main.ts @@ -1,8 +1,9 @@ +import { mount } from 'svelte' import './style.css' import App from './App.svelte' -const app = new App({ - target: document.getElementById('app') +const app = mount(App, { + target: document.getElementById('app') as HTMLElement }) export default app diff --git a/v2/pkg/templates/templates/svelte/frontend/src/main.js b/v2/pkg/templates/templates/svelte/frontend/src/main.js index 95c41a51d20..221e7ebaf1c 100644 --- a/v2/pkg/templates/templates/svelte/frontend/src/main.js +++ b/v2/pkg/templates/templates/svelte/frontend/src/main.js @@ -1,7 +1,8 @@ +import { mount } from 'svelte' import './style.css' import App from './App.svelte' -const app = new App({ +const app = mount(App, { target: document.getElementById('app') }) diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index f5daf0729ec..5c1001358e3 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fixed v2 `svelte` and `svelte-ts` templates scaffolding a blank page by migrating from the removed Svelte 4 `new App()` API to Svelte 5 `mount()` [#6001](https://github.com/wailsapp/wails/issues/6001) by @haoku123 + ## v2.15.0 - 2026-08-17 ### Added