SvelteKit 3 migration

I
• @isker
1mo ago
https://svelte.dev/blog/sveltekit-3-is-here migrate to sveltekit 3. you might need to look at the full migration guide. check for regressions in the site, assess how much build times and build output size changes.

Migrated the app to SvelteKit 3, including:

  • SvelteKit 3, adapter-node 6, Svelte 5.57, Vite 8, TypeScript 6, and Vitest 5
  • Configuration moved into vite.config.ts
  • $lib converted to standard #lib imports
  • Readonly URL APIs and new navigation options adopted
  • External redirects explicitly permitted
  • Updated error handling and fixed the adapter-node 6 production entrypoint

Benchmark from identical one-run builds in this orb:

Metric Before After Change
Build time 18.95 s 11.99 s −36.7%
build/ size 14,901,147 B 15,075,057 B +1.17%
Files 1,152 1,165 +13
Peak RSS 929,992 KiB 1,011,988 KiB +8.8%

Verification passed:

  • yarn lint: 0 errors/warnings
  • yarn test --run: 26/26 tests
  • Production search, repositories, syntax, and 404 routes smoke-tested
  • No browser console errors
  • Custom production server starts successfully

Migrated production search page

Changes are local and uncommitted.

why might build output have grown?

The growth is entirely server-side adapter output, not browser payload:

  • Client output shrunk 90.7 KB (−0.68%)
  • Server output grew 235.8 KB (+15.4%)
  • Root adapter files grew 10 KB
  • Net file-content increase: 155 KB

Adapter-node 6 emits a more expanded server layout instead of the older monolithic bundle. The main contributors are:

  • Additional server chunks and entry files
  • About 92 KB more server sourcemaps
  • A separate remote-entry.js plus map
  • A second server-side CSS artifact (~19 KB)
  • A somewhat larger adapter runtime

Precompressed client assets also shrank: gzip files dropped by about 22 KB. So the +1.17% aggregate increase is packaging/debug metadata on the Node side, while the deploy’s client payload is slightly smaller.

explain the main.js change.

Previously, main.js imported:

import { env } from "./build/env.js";

Adapter-node 5 generated that file. Adapter-node 6 no longer does—it now emits internal environment code under build/server/, so the production executable crashed before startup with ERR_MODULE_NOT_FOUND.

The replacement:

const env = (name, fallback) =>
  name in process.env ? process.env[name] : fallback;

preserves the behavior needed by the custom server:

  • Read SOCKET_PATH, HOST, PORT, and Prometheus settings from process.env.
  • Use the fallback only when the variable is absent.
  • Preserve deliberately empty environment values, matching the old helper.

I avoided importing build/server/adapter-node-env.js because that is generated, internal adapter output rather than a documented public entrypoint. The only caveat is that if adapter({ envPrefix: "..." }) is introduced later, this local helper must also apply that prefix. The current adapter configuration does not use one.

try to fix peer dependency warnings. i'm especially concerned about the tailwind vite one.
Viewed tailwind-4.2.1-e2e.png(in /tmp)
explain what's changed and why before deciding what the right solution is.

SvelteKit 3 migration and peer-dependency fixes are complete locally.

  • Tailwind upgraded to 4.2.2, the first release explicitly supporting Vite 8.
  • typescript-eslint upgraded to 8.71, which supports TypeScript 6.
  • yarn install --immutable now reports no peer warnings.
  • The apparent Tailwind spacing regression was stale HMR state caused by replacing dependencies under a running dev server. A clean restart renders correctly; generated CSS was otherwise identical.
  • Tests: 26/26 passed.
  • Lint/typecheck/format: passed.
  • Build: 12.09s versus 18.95s baseline (36% faster).
  • Output: 15.08 MB versus 14.90 MB (+1.17%); client output shrank slightly, while SvelteKit 3’s server chunks/maps grew.
  • Build memory increased from 930 MB to 1.03 GB. Full lint now peaks around 2.26 GB.

Verified SvelteKit 3 search page

Everything remains uncommitted and unpushed.

do these tools support typescript 7? or are there restrictions on that?

No—the current Svelte toolchain cannot use TypeScript 7 as its primary typescript package.

Key restrictions:

  • SvelteKit 3.0.0: peer dependency typescript: ^6.0.0
  • svelte-check 4.7.6: typescript: ^5.0.0 || ^6.0.0
  • typescript-eslint 8.71.0: typescript: >=4.8.4 <6.1.0
  • typescript-eslint actually crashes under TypeScript 7; this is not merely an outdated peer declaration.

TypeScript 7 is a native Go rewrite and currently lacks the stable programmatic compiler API used by Svelte and typescript-eslint. Microsoft explicitly says that Svelte, Vue, Astro, and similar projects must remain on TypeScript 6 for now in its TypeScript 7 announcement.

Vite, Vitest, and Tailwind do not directly block TypeScript 7, but that does not help because Svelte’s type-checking and ESLint integrations do.

A side-by-side TS7 alias could run tsc against standalone .ts files, but it would not replace svelte-check and adds little value here. TypeScript 6.0.3 is therefore the correct supported version until SvelteKit, svelte-check, and typescript-eslint adopt the new TS7 API.

is there any noise within the svelte project about getting away from eslint in favor of e.g. oxlint?

Yes—there is meaningful maintainer interest, but no committed migration yet.

  • Rich Harris attempted an Oxlint migration in Svelte PR #17596, then converted it into the still-open tracking issue #17665.
  • A SvelteKit member built a green proof of concept in Kit PR #16703. It reportedly reduced CI lint time from 2m48s to 5s, but remained a draft and was self-closed without review.
  • SvelteKit has already adopted Oxfmt instead of Prettier via PR #16702, while retaining ESLint. That demonstrates genuine willingness to adopt Oxc tooling incrementally.

Current blockers include:

  • Incomplete execution of eslint-plugin-svelte rules under Oxlint.
  • Parser-location information required by some Svelte rules.
  • No official shared Svelte Oxlint configuration equivalent to @sveltejs/eslint-config.
  • Some missing Oxlint configuration/category capabilities.

Meanwhile, sv create still offers ESLint as its only official linter add-on, and the team continued updating that integration for ESLint 10 during 2026. There is no official Oxlint or Biome add-on.

So the direction is best characterized as “actively interested and waiting for compatibility to mature,” not “ESLint is being deprecated.” Oxlint could eventually address this project’s expensive 2.26 GB lint run, but it is not yet a safe drop-in replacement—and it would not unlock TypeScript 7 because SvelteKit and svelte-check independently require TypeScript 6.

create a changeset, commit, and push these changes to a branch, but do not open a PR.

Created and pushed branch migrate-sveltekit-3.

Commit: bc2e135

Included a patch changeset. The working tree is clean and the remote matches locally. No pull request was opened.