Skip to content

feat: Migrate to SvelteKit 3 - #244

Draft
hhvrc wants to merge 5 commits into
developfrom
feature/svelte-kit-3
Draft

feat: Migrate to SvelteKit 3#244
hhvrc wants to merge 5 commits into
developfrom
feature/svelte-kit-3

Conversation

@hhvrc

@hhvrc hhvrc commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

No description provided.

hhvrc added 3 commits August 20, 2026 14:07
Ran `sv migrate sveltekit-3` and worked through the manual tasks it collected.

Config:
- `experimental.tracing` -> top-level `tracing.server`, and
  `experimental.instrumentation` is gone (instrumentation.server.ts is picked
  up automatically now)
- `vitePlugin.inspector` moves to the top level of the sveltekit() options
- `KitConfig` is no longer exported from `@sveltejs/kit`; take `Config` from
  `@sveltejs/kit/vite` instead
- tsconfig extends `$app/tsconfig`, mirrors the new `#lib` subpath imports in
  `paths` (svelte-check resolves .svelte imports itself and only understands
  tsconfig paths, not package.json imports) and keeps type-checking the
  config, plugin and e2e sources

Paths:
- `Path` no longer carries a leading slash, so pathname literals, breadcrumb
  and sidebar entries drop it
- `prefixBase()` still takes a union-typed pathname, which `resolve()` cannot
  (it is generic over a single literal path), and derives the base path from
  PUBLIC_SITE_URL the same way vite.config.ts does — `resolve()` returns a
  path relative to the page being rendered, which cannot be compared against
  page.url.pathname nor back the absolute URLs in the sitemap and canonical
  tags

Environment, hooks and navigation:
- `$env/static|dynamic/*` -> `$app/env/*` through the generated src/env.ts;
  the previously dynamic variables keep an empty-string fallback, which every
  consumer treats exactly like the old `undefined`
- `handleError` discriminates on `kind`, so expected app and framework errors
  (404s and friends, which SvelteKit 3 also routes through the hook) log at
  warn instead of drowning real defects in telemetry
- `replaceState()` -> shallow `goto()`, `keepFocus`/`noScroll` -> `reset`
- parameter matchers consolidated into src/params.ts

Also fixes three bugs the type checker surfaced on the way:
- the logo asset is `logo.svg`, not `Logo.svg`, so the social preview image
  and the welcome screen preload were 404ing
- public-routes.ts cast its computed paths to `Path`, which hid the
  leading-slash change from the compiler — sitemap.xml and llms.txt would
  have emitted `https://home/`-style URLs
- redirectLegacyHashRoute() was handed `resolve('')`, yielding the
  protocol-relative `//home`
`pnpm run check` passes `--tsgo`, which svelte-check only honours when
TypeScript 7 is installed under the `@typescript/native` npm alias — otherwise
it aborts with "requires TypeScript 7 to be installed in the workspace".

It was resolving only because pnpm hoists the alias out of the
packages/svelte-core workspace package, so any lockfile change that dropped it
there silently broke type-checking here. Declare it locally, matching the
version svelte-core pins.

TypeScript itself stays on 6: @sveltejs/kit 3, svelte-check and
typescript-eslint all cap their `typescript` peer below 7.
The (app) auth gate sent the interrupted destination to /login as `next`, but
nothing ever read that parameter: the login flow and the (auth) layout both go
through gotoQueryRedirectOrFallback(), which reads REDIRECT_QUERY_PARAM.
Signing back in after a session expired therefore always landed on /home.

Use the constant on both sides so the two halves cannot drift again.
@hhvrc hhvrc self-assigned this Aug 20, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
openshock-app-dev 8e69b0a Aug 20 2026, 02:15 PM

@hhvrc hhvrc changed the title feat: SveletKit 3 feat: SvelteKit 3 Aug 20, 2026
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d485115d-136d-40dc-b30a-1216246788c4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hhvrc hhvrc changed the title feat: SvelteKit 3 feat: Migrate to Svelte Kit 3 Aug 20, 2026
@hhvrc hhvrc changed the title feat: Migrate to Svelte Kit 3 feat: Migrate to SvelteKit 3 Aug 20, 2026
hhvrc added 2 commits August 20, 2026 14:27
All seven conflicts were the same kind: develop reached the same result in
SvelteKit 2 spelling while this branch had already migrated it.

- `asset()`/`resolve()` arguments keep this branch's slashless form; the
  substance of develop's `Logo.svg` -> `logo.svg` casing fix is already here.
- `#lib/...js` imports keep this branch's subpath form over `$lib`.
- develop's redirect-after-reauth fix is the same change as f609688.
- pnpm-lock.yaml follows package.json in dropping formsnap and
  sveltekit-superforms from the root importer; packages/svelte-core keeps both.
package.json keeps this branch's prerelease pins for `@sveltejs/kit` and
both adapters, plus its `#lib` imports map, and takes develop's other
bumps — vite-plugin-svelte, svelte, svelte-check, svelte-sonner and
pnpm 11.22.0.

pnpm-lock.yaml is regenerated from this branch's copy so the SvelteKit 3
prereleases stay pinned. Regenerating left a stale svelte 5.56.8 beside
5.56.9, which is the duplicate that makes every snippet fail to type-check
against a `Snippet` prop; `pnpm dedupe` collapses it, and the
`dedupe --check` step this merge brings in from develop guards it going
forward.

The submodule points at svelte-core's own feature/svelte-kit-3 rather than
its master, and .gitmodules now records that branch, so
`git submodule update --remote` tracks the migration branch here instead of
pulling master back in.
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.

1 participant