Skip to content

Add SvelteKit 3 support - #204

Merged
feugy merged 4 commits into
canaryfrom
feugy/sveltekit-3-support
Jul 6, 2026
Merged

feugy merged 4 commits into
canaryfrom
feugy/sveltekit-3-support

Conversation

@feugy

@feugy feugy commented Jul 3, 2026 •

Copy link
Copy Markdown
Member

🖖🏻 What's in there?

Adds SvelteKit 3 support via @vercel/analytics/sveltekit-next while keeping @vercel/analytics/sveltekit on the existing SvelteKit 2 integration.

Introduces a new test application for sveltekit@3, while preserving the previous SvelteKit app as sveltekit-old for SvelteKit 2 coverage.

🤺 How to test?

Ultimate test is to use the test apps:

Visit these apps with your devtools open on the network tab.
Click on the link to navigate away.
Check the payload of the POST to /insights/view: you'll see the pageview attributed to the correct route.

I also ran:

  • pnpm -F @vercel/analytics test
  • pnpm -F @vercel/analytics build
  • pnpm -F sveltekit check
  • pnpm -F sveltekit build
  • pnpm -F sveltekit-old check
  • pnpm -F sveltekit-old build

🔬 Notes to reviewers

This mirrors the SvelteKit 3 split from vercel/speed-insights#120: use $app/state in a new sveltekit-next export while preserving the stable SvelteKit 2 export based on $app/stores.

@vercel

vercel Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
analytics-astro Ready Ready Preview, Comment Jul 6, 2026 2:17pm
analytics-next15 Ready Ready Preview, Comment Jul 6, 2026 2:17pm
analytics-nextjs Ready Ready Preview, Comment Jul 6, 2026 2:17pm
analytics-nuxt Ready Ready Preview, Comment Jul 6, 2026 2:17pm
analytics-remix Ready Ready Preview, Comment Jul 6, 2026 2:17pm
analytics-sveltekit Ready Ready Preview, Comment Jul 6, 2026 2:17pm
analytics-sveltekit-old Ready Ready Preview, Comment Jul 6, 2026 2:17pm
analytics-vue Ready Ready Preview, Comment Jul 6, 2026 2:17pm

Request Review

@socket-security

socket-security Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​sveltejs/​adapter-vercel@​7.0.0-next.01001007494100
Addednpm/​@​sveltejs/​kit@​3.0.0-next.6991008198100
Addednpm/​@​sveltejs/​vite-plugin-svelte@​4.0.41001008193100
Addednpm/​vue@​3.5.391001009196100

View full report

@feugy

feugy commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@teemingc If you want to have a look, here is the equivalent on web-analytics

Comment thread apps/sveltekit/src/routes/+layout.ts Outdated

@Rich-Harris Rich-Harris left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one small question but otherwise LGTM!

@feugy
feugy merged commit 78889fa into canary Jul 6, 2026
15 checks passed
@feugy
feugy deleted the feugy/sveltekit-3-support branch July 6, 2026 14:24
andriytyurnikov added a commit to andriytyurnikov/andriytyurnikov.me that referenced this pull request Oct 2, 2026
Migrated with `sv migrate sveltekit-3`, keeping only its semantic edits
(its printer also rewrote markup: `/>` to `></path>`, entities, inline
whitespace):

- svelte.config.js is gone; its options now go to the sveltekit() plugin
  in vite.config.js
- $lib is now #lib via package.json `imports`, $app/environment is
  $app/env, and jsconfig.json extends $app/tsconfig
- resolve() takes paths without a leading slash; the homepage photo, a
  static file, uses asset() instead
- onNavigate handlers skip shallow navigations, which now fire them

@vercel/analytics and @vercel/speed-insights are pinned to the canaries
2.1.0-canary.5 and 2.1.0-canary and imported from /sveltekit-next
(vercel/analytics#204, vercel/speed-insights#120). Their /sveltekit entry
still imports $app/stores, which Kit 3 removed, so the root layout threw
and the app never hydrated. Move to stable releases once they ship.

Verified: prettier, eslint, svelte-check (0 errors), 28 unit tests, 10 e2e
tests, production build, and in a production preview: no page errors,
client-side navigation, and pageviews queued with the right route.
@Rich-Harris Rich-Harris mentioned this pull request Oct 5, 2026

This branch was successfully deployed

8 active deployments
Preview – analytics-nextjs — 5170e0a0 Deployed Jul 6, 2026 by vercel[bot]
Preview – analytics-nuxt — 5170e0a0 Deployed Jul 6, 2026 by vercel[bot]
Preview – analytics-sveltekit-old — 5170e0a0 Deployed Jul 6, 2026 by vercel[bot]
Preview – analytics-next15 — 5170e0a0 Deployed Jul 6, 2026 by vercel[bot]
Preview – analytics-sveltekit — 5170e0a0 Deployed Jul 6, 2026 by vercel[bot]
Preview – analytics-remix — 5170e0a0 Deployed Jul 6, 2026 by vercel[bot]
Preview – analytics-astro — 5170e0a0 Deployed Jul 6, 2026 by vercel[bot]
Preview – analytics-vue — 5170e0a0 Deployed Jul 6, 2026 by vercel[bot]
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.

2 participants