Skip to content

SvelteKit 2, with the Vite 5 toolchain it needs (supersedes #176) - #224

Merged
xuelink merged 2 commits into
mainfrom
claude/sveltekit-2
Sep 24, 2026
Merged

xuelink merged 2 commits into
mainfrom
claude/sveltekit-2

Conversation

@xuelink

@xuelink xuelink commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Replaces #176. Dependabot bumped @sveltejs/kit to 2 and @sveltejs/adapter-static to 3 on their own, and its CI failed at npm install (ERESOLVE): Kit 2 needs Vite 5, the repo was on Vite 4, and vitest 0.32 pinned Vite 4 through vite-node. This PR does the whole step.

Versions

Package Before After
@sveltejs/kit 1.30.4 2.70.3
@sveltejs/adapter-static 2.0.3 3.0.10
@sveltejs/vite-plugin-svelte (via Kit) 3.1.2, now a direct dependency
vite 4.5.12 5.4.21
vitest 0.32.4 3.2.7
typescript 5.2.2 5.9.3
svelte-check 3.5.2 3.8.6
devalue (what #176 was about) 4.3.2 5.9.4
@types/node 20.8.7, via vitest 0.32 20.19.43, a direct dev dependency

Svelte stays on 4.2.19; vite-plugin-svelte 3 is the line that supports it. sass stays on 1.69.4.

Code — two changes from the migration guide, the rest do not apply here (no cookies, goto, $env/dynamic, $app/paths, hooks, form actions or top-level promises in a load):

  • svelte.config.js imports vitePreprocess from @sveltejs/vite-plugin-svelte.
  • The nine throw error(...) in the tools loaders drop the throw.

Checks

  • npm run check: 0 errors (warnings went from 8 to 2; the newer svelte-check knows text-wrap and container-type).
  • vite build before and after: the same 1,371 pages and 5,278 other files. Every static file is byte-identical. Every page's HTML is identical once scripts, stylesheet links and hashes are set aside. The CSS each page loads has the same rules; only the asset hash format changes, and the newer esbuild writes rgba(255,255,255,.25) as the equivalent #ffffff40.
  • A fresh npm install from the new lockfile in an empty folder, as CI does it, resolves with no conflicts.
  • Full npm run build (image optimisation and sitemap) under Node 20, the CI version.
  • In the browser on the Vite 5 dev server: the homepage hydrates, the guess game and FAQ respond, the theme toggle cycles, client-side navigation from the header works, the /compare picker switches apps, /plans, a comparison post and /tools/say/hello render, with no console errors.

Notes

  • The first CI run failed svelte-check with 25 errors: vitest 0.32 had brought @types/node in, vitest 3 does not, so node:path and node:fs/promises went untyped. It passed locally because the worktree sits inside the main checkout and TypeScript found the types in the parent's node_modules. The second commit adds @types/node 20 directly, and the whole CI job (clean npm install, npm run check, full npm run build) was then re-run under Node 20 in a copy outside the checkout: 0 errors, 1,371 pages, output identical to the local build.
  • npm cannot move Kit, adapter-static and Vite together from the old lockfile (it checks each new peer against the version still installed), so the lockfile was produced with --legacy-peer-deps and then re-run with a plain npm install; npm ls --all is clean.
  • pnpm-lock.yaml is left alone. It was already stale (no posthog-js, gsap or three) and npm is what CI and the deploy use.
  • npm run build fails on Node 24 in the image-transmutation postbuild step (its esm loader breaks). That is unrelated to this change and does not affect CI, which runs Node 20.

🤖 Generated with Claude Code

xuelink and others added 2 commits September 23, 2026 20:51
Dependabot's #176 bumped @sveltejs/kit to 2 and adapter-static to 3 on
their own, and its CI died at `npm install`: Kit 2 needs Vite 5, the repo
was on Vite 4, and vitest 0.32 pinned Vite 4 through vite-node. This does
the whole step at once:

- @sveltejs/kit 1.30.4 -> 2.70.3, @sveltejs/adapter-static 2.0.3 -> 3.0.10
- @sveltejs/vite-plugin-svelte 3.1.2, now a direct dependency (a peer of
  Kit 2); 3.x is the line that supports Svelte 4, which stays at 4.2.19
- vite 4.5.12 -> 5.4.21, vitest 0.32.4 -> 3.2.7 (no tests exist yet; it is
  the newest line that still accepts Vite 5)
- typescript 5.2.2 -> 5.9.3 (Kit 2 wants ^5.3.3), svelte-check 3.5.2 -> 3.8.6
- devalue, which the Dependabot PR was about, goes 4.3.2 -> 5.9.4

Code: `vitePreprocess` now comes from @sveltejs/vite-plugin-svelte, and the
nine `throw error(...)` in the tools loaders lose the `throw` (in Kit 2
`error()` throws by itself). Nothing else in the migration guide applies:
no cookies, `goto`, `$env/dynamic`, `$app/paths`, hooks, form actions or
top-level promises in a load.

npm could not move Kit, adapter-static and Vite together from the old
lockfile (it checks each new peer against the version still installed),
so the lockfile was produced with --legacy-peer-deps and then re-run with a
plain `npm install`, which leaves `npm ls --all` clean. A fresh install
from the lockfile in an empty folder, as CI does it, resolves without error.

Checked: svelte-check 0 errors; `vite build` writes the same 1,371 pages
and 5,278 other files, every static file byte-identical, and every page's
HTML identical once scripts, stylesheet links and hashes are set aside.
The CSS each page loads has the same rules; the only differences are asset
hash formats and the new esbuild writing rgba(255,255,255,.25) as #ffffff40.

pnpm-lock.yaml is left alone: it was already stale (it has no posthog-js,
gsap or three) and npm is what CI and the deploy use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vitest 0.32 depended on @types/node, so the Node types came in with it;
vitest 3 only lists them as an optional peer, and with the upgrade they
left the tree. CI's svelte-check then found 25 errors, all from that one
gap: `node:path`, `node:fs/promises` and `path` unresolved in the tools
loaders, src/lib/server/ipa.ts and vite.config.ts, and everything typed
from them falling back to `any`.

The local check had passed because this worktree sits inside the main
checkout, and TypeScript found @types/node in the parent's node_modules.
Pinned to the 20 line, the Node version CI and the deploy run on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@xuelink
xuelink merged commit abb9b20 into main Sep 24, 2026
1 check passed
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