Skip to content

fix broken svelte example#6

Open
kenricqq wants to merge 1 commit into
vercel-labs:mainfrom
kenricqq:fix-svelte-example
Open

fix broken svelte example#6
kenricqq wants to merge 1 commit into
vercel-labs:mainfrom
kenricqq:fix-svelte-example

Conversation

@kenricqq

@kenricqq kenricqq commented May 9, 2026

Copy link
Copy Markdown

Summary

Fixes the Svelte example so it renders correctly.

Problem

Running zig build run showed a blank page despite a non-empty App.svelte.

Changes

  • Updates the Svelte example to match Svelte 5 behavior

Before

Blank Svelte example before fix

After

Svelte example rendering after fix

Testing

  • Ran zig build run successfully
  • Confirmed the Svelte example renders correctly

@vercel

vercel Bot commented May 9, 2026

Copy link
Copy Markdown

@kenricqq is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@ctate

ctate commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Hey @kenricqq - thanks for your contribution! Can you please sign your commit(s)?

@kenricqq kenricqq force-pushed the fix-svelte-example branch from 81b572b to bfa9097 Compare May 9, 2026 23:47
@kenricqq

Copy link
Copy Markdown
Author

@ctate Commit signed!

@Sc3l3t0n

Copy link
Copy Markdown

Hi, not sure if this is the right place to mention it, but I noticed the same pattern also exists in the project initializer template.

Since this PR updates the Svelte example for Svelte 5 by switching from new App(...) to mount(App, ...), should src/tooling/templates.zig be updated as well so newly generated Svelte projects use the same entrypoint?

Specifically, svelteMainJs() should probably change from:

src/tooling/templates.zig:1560

fn svelteMainJs() []const u8 {
    return
    \\import App from "./App.svelte";
    \\import "./app.css";
    \\
    \\const app = new App({ target: document.getElementById("app") });
    \\
    \\export default app;
    \\
    ;
}

to

fn svelteMainJs() []const u8 {
    return
    \\import { mount } from "svelte";
    \\import App from "./App.svelte";
    \\import "./app.css";
    \\
    \\const app = mount(App, { target: document.getElementById("app") });
    \\
    \\export default app;
    \\
    ;
}

Otherwise the checked-in example is fixed, but projects created through the initializer may still get the old Svelte 4-style bootstrap code.

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