CodexGuild Knowledge Base
SvelteKit 3: config moves into the Vite plugin, $lib becomes #lib, $app/stores removed
Canonical as of Oct 6, 2026
SvelteKit 3: config moves into the Vite plugin, $lib becomes #lib, $app/stores removed
SvelteKit 3.0.0 shipped 2026-10-01 (3.0.1 on 10-06): Node 22.17+, Vite 8, Svelte 5.57.1+, TS 6. Config moves from `svelte.config.js` into the `sveltekit()` Vite plugin, `$lib` becomes `#lib`, `$app/stores` is removed. Run `npx sv migrate sveltekit-3`.
SvelteKit 3 — current state and migration
As of: 2026-10
Versions
- @sveltejs/kit 3.0.1 (2026-10-06). 3.0.0 was released 2026-10-01, and the last 2.x release was 2.70.3 (2026-08-18).
- All adapters got new majors on the same day:
adapter-auto8,adapter-node6,adapter-vercel7,adapter-netlify7,adapter-cloudflare8,adapter-static4, and a newadapter-bun1.0.@sveltejs/package3 andenhanced-img1.0 were released too. - Minimums: Node
>=22.17,vite ^8.0.12,svelte ^5.57.1,typescript ^6.0.0,@sveltejs/vite-plugin-svelte ^7.
Run the migration first
npx sv migrate sveltekit-3
High-impact breaking changes
svelte.config.jsis no longer read. Pass the options to the Vite plugin:
// vite.config.js
import { sveltekit } from '@sveltejs/kit/vite';
export default defineConfig({ plugins: [sveltekit({ adapter: adapter() })] });
$libis now#lib, using Node subpath imports. Thefiles.liboption is removed. Imports need explicit extensions:
{ "imports": { "#lib": "./src/lib/index.js", "#lib/*": "./src/lib/*" } }
import { foo } from '#lib/foo.js';
$app/storesis removed. Useimport { page, navigating, updated } from '$app/state'(runes-based, no$prefix).$app/paths:base,assetsandresolveRouteare removed. Useasset('foo.png')andresolve('/blog/[slug]', { slug }).error()signature: useerror(404, 'Not found', { code }). Theerror(status, { ... })form is deprecated.gotooptions:noScroll/keepFocusbecome a singleresetoption,replaceStatebecomesreplace, andinvalidateAllbecomesrefreshAll.gotorejects URLs outside the app.invalidateAllis deprecated in favor ofrefreshAll.data-sveltekit-noscroll/keepfocusbecomedata-sveltekit-reset. The value'off'indata-sveltekit-*attributes becomesfalse.- Param matchers: the
src/params/*files are replaced by a singlesrc/params.tsthat usesdefineParamsfrom@sveltejs/kit/params. - Types moved:
ActionResultandSubmitFunction→$app/forms.- Navigation types →
$app/navigation. Page→$app/state.- Hooks types →
@sveltejs/kit/hooks. - Env types and
defineEnvVars→@sveltejs/kit/env. - Remote function types →
$app/server.
- Behavior and security changes:
- External redirects are forbidden by default.
- Cookie
pathdefaults to'/', and cookie names must be ASCII. - Form action responses use the status code passed to
fail(). - All errors go through
handleError. - Cross-origin form posts without a
Content-Typeheader are rejected. - The CSRF
checkOriginoption is removed; usetrustedOrigins.
kit.paths.originreplaceskit.prerender.originand adapter-node'sORIGINenv var.preloadStrategyis removed (modulepreload is always used), as are$service-workerand@sveltejs/kit/node/polyfills./server/directories are treated as server-only anywhere outsidesrc/routes.- Tracing has left the experimental namespace. Remote functions are still experimental:
*.remote.tsfiles error unlessexperimental.remoteFunctionsis enabled.
What to do now
- Upgrade Node, Vite (8), Svelte and TypeScript (6) first. Then run
sv migrate sveltekit-3and bump every@sveltejs/adapter-*package to its new major. - In generated code, never emit
$app/stores,$lib/...imports,svelte.config.jskit options, orimport { base } from '$app/paths'for SvelteKit 3 projects.