What's New in SvelteKit 3
SvelteKit 3 removes deprecated APIs and changes config, imports, navigation and adapters. See the breaking changes, version requirements and upgrade steps.
SvelteKit 3 is mostly a cleanup release: it removes long-deprecated APIs, moves configuration into Vite, and raises minimum dependency versions, with very few new features.
The release notes look small, but most SvelteKit 2 apps still need real work to upgrade. Nearly every app is affected by svelte.config.js going away and by the switch from $lib to #lib, and some apps also depend on things like the Vercel edge runtime or Cloudflare platform bindings that SvelteKit 3 no longer supports.
SvelteKit 3.0 shipped on October 1, 2026. The team describes it as the same framework with more polish and type safety and less junk. This article goes through the breaking changes roughly in the order you’ll run into them, shows the SvelteKit 3 form of each, and then gives the upgrade sequence.
Key Takeaways
- SvelteKit 3 requires at least Node 22.17, TypeScript 6, Svelte 5.57.1, Vite 8.0.12 and @sveltejs/vite-plugin-svelte 7.
- SvelteKit 3 no longer reads
svelte.config.js. All configuration goes into thesveltekit()plugin call in your Vite config file. - The
$libalias is replaced by#lib, a Node subpath import declared inpackage.json, and every#libimport must include an explicit file extension. $app/storesis removed,invalidateAllis deprecated in favor ofrefreshAll, and the second argument toerror()must be a string.- To upgrade, move to the latest SvelteKit 2.x and clear its deprecation warnings, then run
npx sv migrate sveltekit-3and work through the TODO list it writes.
What Are the SvelteKit 3 Breaking Changes?
The changes most likely to break a SvelteKit 2 app are the config move, #lib, and the removed $app/stores module. The adapter changes are less common, but they can block a deploy completely.
| Change | SvelteKit 2 | SvelteKit 3 |
|---|---|---|
| Minimums | Node 18+, Vite 5–8 | Node 22.17, TS 6, Svelte 5.57.1, Vite 8.0.12 |
| Config | svelte.config.js | sveltekit({...}) in Vite config |
| Lib alias | $lib/foo | #lib/foo.js |
| Modules | $app/stores, $app/environment, $env/* | $app/state, $app/env, $app/env/private / public |
| Navigation | invalidateAll, replaceState, keepFocus | refreshAll, replace, reset: false, shallow |
| Errors | error(404, { message }) | error(404, 'message') |
| Params | src/params/*.js | src/params.ts with defineParams |
| Tracing | experimental.tracing | top-level tracing |
| Adapters | Vercel edge, Cloudflare platform | Node runtime only; cloudflare:workers |
Toolchain and Configuration Changes
1. Minimum Versions
SvelteKit 3.0 requires at least:
- Node v22.17
- TypeScript v6
- Svelte v5.57.1
- Vite v8.0.12 (the first Vite 8 release that bundles stable rolldown v1)
- @sveltejs/vite-plugin-svelte v7
Svelte 4 is no longer supported. SvelteKit 2 already worked with Vite 8, but SvelteKit 3 makes it a requirement. Before you touch any code, upgrade Node in CI and in your hosting runtime.
2. svelte.config.js Is Gone
SvelteKit 3 no longer reads svelte.config.js at all. Every option that used to sit under the kit key is now a top-level option of the sveltekit() plugin in your Vite config file. Both vite.config.js and vite.config.ts work:
// vite.config.js
import adapter from '@sveltejs/adapter-auto';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [
sveltekit({
adapter: adapter()
})
]
});
Put compilerOptions next to the SvelteKit options. Anything SvelteKit doesn’t recognize is forwarded to vite-plugin-svelte. Experimental flags live here too. Remote functions are still experimental in SvelteKit 3 and depend on Async Svelte, which is also behind an experimental flag. To enable them, set experimental: { remoteFunctions: true } and compilerOptions.experimental.async in the plugin options.
Import and Module Changes
3. $lib Becomes #lib
In SvelteKit 3, #lib replaces the $lib alias. #lib is a Node subpath import that you declare in the imports field of package.json:
{
"imports": {
"#lib": "./src/lib/index.js",
"#lib/*": "./src/lib/*"
}
}
Subpath imports don’t guess file extensions or directory indexes, so every import has to name a specific file:
import { formatDate } from '#lib/utils.js';
import { helpers } from '#lib/helpers/index.js';
If an import points at a directory or leaves off the extension, the build fails with a module resolution error. Netlify’s release notes call this the change you are most likely to hit. To fix it, add the file name or the index path, including its extension.
4. $app/stores, $app/environment, $service-worker and $env
The $app/stores module no longer exists in SvelteKit 3. Components import page from $app/state and read it directly, not through the $page store:
<script>
import { page } from '$app/state';
</script>
<p>Current path: {page.url.pathname}</p>
page.url is now typed as immutable. If you need to change it, make a copy first with new URL(page.url.href).
The other module changes:
$app/environmentis renamed to$app/env, which can now also be imported inside a service worker.$service-workeris removed.versionnow comes from$app/env,assets,immutableandprerenderedfrom$app/manifest, andresolvefrom$app/paths.- The
$env/*modules are deprecated in favor of$app/env/privateand$app/env/public. Explicit environment variables are now stable. You declare them insrc/env.tsusingdefineEnvVarsfrom@sveltejs/kit/env.
Navigation and Error Handling
5. refreshAll and New goto Options
In SvelteKit 3, invalidateAll is deprecated in favor of refreshAll. In practice, the difference is that refreshAll keeps page.state as it is, while invalidateAll reset it to an empty object. The goto options have been renamed too, and shallow routing now goes through goto instead of pushState and replaceState:
import { goto, refreshAll } from '$app/navigation';
// SvelteKit 2 options
await goto('/search', { replaceState: true, keepFocus: true, noScroll: true });
// SvelteKit 3
await goto('/search', { replace: true, reset: false });
// Shallow routing (replaces pushState / replaceState)
await goto('/photos/42', { shallow: true, state: { selected: 42 } });
// Rerun load functions without clearing page.state
await refreshAll();
The goto option previously named invalidateAll is now refreshAll. goto now rejects any URL that doesn’t resolve to a route in your app, so use window.location.href for external URLs. Shallow navigations also fire beforeNavigate, onNavigate and afterNavigate. The $app/navigation reference lists the full option set.
6. error() Takes a String
In SvelteKit 3 the second argument to error() must be a string. Any extra properties go in a third argument, not in an object as the second:
import { error } from '@sveltejs/kit';
error(404, 'Post not found');
handleError now receives expected errors as well as unexpected ones, and it can return a status. handleValidationError has been removed. Because SvelteKit 3 requires Svelte 5, it can use error boundaries, so error handling is now consistent across rendering.
Params, Tracing and Adapters
7. Param Matchers Move to src/params.ts
In SvelteKit 3, param matchers are no longer separate files in src/params/. They are all defined in a single src/params.ts:
// src/params.ts
import { defineParams } from '@sveltejs/kit/params';
export const params = defineParams({
fruit: (param) => {
if (param === 'apple' || param === 'orange') return param;
}
});
Each matcher returns either the parsed value or undefined. A Standard Schema can also be used in place of a function.
8. Tracing Is Stable
In SvelteKit 3, tracing has moved from experimental.tracing to a top-level tracing option. You no longer need experimental.instrumentation: instrumentation turns on automatically when src/instrumentation.server.js exists.
9. Adapter Changes
All first-party adapters require SvelteKit 3, and adapter-vercel no longer supports the edge runtime. Any route that exports an edge runtime config has to move to Node before you deploy.
With adapter-cloudflare, Cloudflare APIs are no longer available on platform. Import them from the Workers runtime:
import { env, waitUntil } from 'cloudflare:workers';
const value = await env.MY_KV.get('key');
Use request.cf for cf properties. caches is a global. Run wrangler types to generate the binding types. The adapter-cloudflare docs cover local emulation of cloudflare:workers.
Smaller Changes
The migration guide also lists three smaller changes: cookie v2 only allows ASCII names and defaults path to /, csrf.trustedOrigins replaces csrf.checkOrigin, and version.pollInterval now defaults to one hour.
How to Upgrade to SvelteKit 3
To upgrade, move to the latest SvelteKit 2.x release and clear its deprecation warnings, run npx sv migrate sveltekit-3, and then work through the TODO list it writes for anything it couldn’t migrate.
- Upgrade
@sveltejs/kitto the latest 2.x release and fix the targeted deprecation warnings it prints. - Run the migration on a clean branch:
npx sv migrate sveltekit-3
- Resolve the remaining items.
sv migrate migrates as much as it can automatically, including dependency bumps, and writes a TODO list for whatever it can’t handle. The official announcement adds --tasks all --confirm so every task runs without prompting: npx sv migrate sveltekit-3 --tasks all --confirm. After the codemod runs, the build and the dev server will surface any remaining #lib resolution errors and adapter issues.
Conclusion
SvelteKit 3 doesn’t ask you to learn a new framework. It asks you to pay down the deprecations SvelteKit 2 had been warning about. Most of the work is config, imports, and a handful of renamed APIs. If you deploy to Vercel edge or use Cloudflare platform bindings, plan for adapter work as well. Start with your deployment target: if it runs Node 22.17 or later and doesn’t depend on the edge runtime, upgrade to the latest 2.x today, clear its warnings, and run sv migrate on a branch.
FAQs
Can I move my config into vite.config.js before upgrading to SvelteKit 3?
Yes. SvelteKit 2.62 added support for configuring SvelteKit through the sveltekit() plugin in vite.config.js, so you can move options out of svelte.config.js while still on SvelteKit 2. Doing this first splits the upgrade into smaller steps. The config move ships and gets tested on its own, leaving fewer changes for the SvelteKit 3 jump, which no longer supports svelte.config.js.
Why is my error tracker full of 404s after upgrading to SvelteKit 3?
In SvelteKit 3, handleError runs for expected errors thrown with error(), such as error(404, 'Post not found'), as well as for unexpected crashes. Any reporting code inside handleError, like a Sentry capture call, now sees every 404 and 403. Check the status passed to the hook and only report errors at or above the threshold you care about, typically 500.
Why does npm install fail with a peer dependency error after bumping to SvelteKit 3?
A third-party package in your dependency tree probably declares a peer dependency that only accepts @sveltejs/kit 2, which conflicts with 3.x. npm 7 and later report unresolved peer conflicts as an ERESOLVE error. Search package.json and your lockfile for packages that peer on @sveltejs/kit, and upgrade each one to a release whose peer range includes version 3.
Gain Debugging Superpowers
Unleash the power of session replay to reproduce bugs, track slowdowns and uncover frustrations in your app. Get complete visibility into your frontend with OpenReplay — the most advanced open-source session replay tool for developers.
Star on GitHub12k