@sveltejs/kit@3.0.0-next.15
Breaking Changes📦 sveltekitView on GitHub →
⚠ 56 breaking✨ 24 features🐛 11 fixes⚡ 6 deprecations🔧 171 symbols
Summary
This release introduces significant breaking changes, including updated minimum version requirements for TypeScript and Node.js, and changes to how requests, cookies, and routes are handled. It also brings numerous new features and bug fixes.
⚠️ Breaking Changes
- Removed `experimental.handleRenderingErrors` flag.
- Made `getRequest` and `setResponse` synchronous.
- Minimum required TypeScript version is now 6.
- All load functions/queries are now refreshed when clicking a link to the current URL.
- Upgraded to `cookie` v2. Cookie names must now contain only ASCII characters. Update cookie names to be ASCII.
- Requires Node 22 or newer. Update your Node.js version.
- Removed the `preloadStrategy` option. `modulepreload` will always be used.
- Defaulted the cookie `path` option to `'/'`.
- Removed `@sveltejs/kit/node/polyfills`.
- Added `config.kit.output.linkHeaderPreload` to preload using the `Link` header.
- Requires `@sveltejs/vite-plugin-svelte` v7.
- Made `page.url` immutable on a type level.
- Removed `base`, `assets`, and `resolveRoute` from `$app/paths`.
- Removed `createEntries` from the `Builder` object passed to adapter functions.
- Returns no content for 204 responses.
- Renamed `Pathname` type to `Path` and `Asset` to `AssetPath`. Removed leading `/` from `Path` and `AssetPath`.
- `handle`'s `resolve` is now typed to always return a `Promise`.
- Svelte config options must now be passed through the Vite plugin.
- Form action responses now use the HTTP status code returned from `fail`.
- Writes tsconfig to `node_modules/$app/tsconfig`.
- Removed the deprecated CSRF `checkOrigin` option in favor of `trustedOrigins`.
- The `delta` property now only exists for `popstate` navigation events.
- Changed `form.error` type from `any` to `App.Error | undefined`.
- Removed deprecated `pragma` header in version polling for improved CORS support.
- `goto` now rejects when called with a URL that does not resolve to a route within the app, matching the existing behaviour for external URLs.
- Requires Svelte 5.56.4 or newer.
- Errors on `event.url`, `event.params`, and `event.route` access inside queries.
- Deleted `$service-worker` module.
- Moved `defineEnvVars` to `@sveltejs/kit/env`.
- Nested server-only directories are now treated as server-only everywhere inside the project (except `src/routes` and the assets directory).
- The `$lib` alias is replaced with `#lib` and `files.lib` config is removed. Update imports from `$lib` to `#lib`.
- Added 'error' result type to `preloadData`.
- Detects new deployments on data, remote, and form action responses, tab focus, and visibility change, and defaults `version.pollInterval` to 1 hour.
- Disallows cross-origin form submissions without a `Content-Type` header.
- Server-only directories (`/server/` in the path) are now treated as server-only everywhere inside the project (except `src/routes` and the assets directory).
- `config` exported from a universal route file takes precedence over a server one.
- Requires Vite 8. Provides new functionality even for existing Vite 8 users such as faster builds with Vite hook filters and more powerful SvelteKit adapters with the Vite environment API. Update Vite to version 8.
- Removed `data-sveltekit-*` option `'off'` in favour of `false`.
- Moved tracing out of the experimental namespace and removed the instrumentation flag.
- Added `kit.paths.origin` config option, removed `kit.prerender.origin` and the `adapter-node` `ORIGIN` environment variable.
- Removed `$app/stores`.
- Added `refreshAll` and deprecated `invalidateAll`. Use `refreshAll` instead of `invalidateAll`.
- Disallows `*.remote.ts/js` files unless `experimental.remoteFunctions` is enabled.
- Replaced the `noScroll` and `keepFocus` options of `goto` with a single `reset` option, and the `data-sveltekit-noscroll` and `data-sveltekit-keepfocus` attributes with `data-sveltekit-reset`.
- Don't abort navigation when calling `invalidate(All)` during navigation.
- Consistent special filename patterns.
- Allow `handleError` to influence status code.
- Delegate CORS handling to Vite for static directory requests during development.
- Requires `vite@^8.0.12`, the first Vite 8 release bundling stable `rolldown` 1.0.0.
- Only include routes with a `+page` or `+server` in `RouteId`.
- Requires Node 22.17.
- Deprecated `error(status, {...})` in favour of `error(status, message, {...})`.
- Forbid external redirects by default.
- Removed param files in folder in favor of `params.js/ts` file.
- `preloadCode` now takes a route ID (e.g. `/blog/[slug]`) instead of a pathname. Route IDs are not prefixed with `paths.base`.
- Removed deprecated `.run()` method from live queries.
Migration Steps
- Update cookie names to be ASCII.
- Update your Node.js version to 22 or newer.
- Update Vite to version 8.
- Update imports from `$lib` to `#lib`.
✨ New Features
- Allow adapters to provide additional Vite plugins.
- Allow hyphens in param and matcher names.
- Added `$app/manifest` module with `immutable`, `assets`, `prerendered`, and `routes` exports.
- Added `ErrorProps` to generated types.
- Support sourcemaps in production.
- Return the list of compressed files from `builder.compress`.
- Warn when tsconfig doesn't exclude service worker ([#16645](https://github.com/sveltejs/kit/pull/16645)).
- Validate that all remote form fields were created with form.fields.foo.as(...).
- Support function validators for environment variables.
- Use `type: 'module'` for service worker registrations.
- Add shallow routing to `goto` and deprecate `pushState` and `replaceState`.
- Make `$app/paths` importable in service workers.
- Preserve page state set through `goto(..., { state, persistState: true })` across reloads.
- Reinstated `$env/static/private`, `$env/dynamic/private`, `$env/static/public`, `$env/dynamic/public` and `$app/environment` as deprecated aliases for `$app/env/private` `$app/env/public` and `$app/env`.
- Add `page` and `endpoint` booleans to `$app/manifest`'s `routes`, and export a `ManifestRoute` type.
- `$app/service-worker` module.
- Resolve paths using the Vite config `root` option instead of `process.cwd()` to better support monorepo configurations such as Vitest workspaces.
- Better error logging.
- Add `PageRouteId` and `EndpointRouteId` to `$app/types`.
- Better tsconfig validation.
- Add `dirty()` property to form fields.
- Add `cookies.parse` method.
- Support custom values in `page.state` via `transport` hook ([#16662](https://github.com/sveltejs/kit/pull/16662)).
- Warn when naively proxying requests that result in responses with a `content-encoding` header ([#16633](https://github.com/sveltejs/kit/pull/16633)).
🐛 Bug Fixes
- Persist global app state across module graph reloads ([#16663](https://github.com/sveltejs/kit/pull/16663)).
- Generate valid `Path` types for routes with optional or rest params, several params in one segment, or escape sequences.
- Allow `undefined` values to be passed to form field `.as(...)` where applicable.
- Don't treat callable standard schemas as function param matchers.
- Decode all numeric character references, including above `ffff`, when crawling prerendered pages.
- Include queries refreshed from within another query in the serialized response.
- Reject malformed streamed data encoding.
- Cache the default cookie header parse and avoid allocations in `cookies.get`.
- Exclude deleted cookies from `cookies.getAll()` so it stays consistent with `cookies.get()`.
- Hide stack traces for internal errors like 404s.
- Default cookies to `secure` to `false` during development.
Affected Symbols
`experimental.handleRenderingErrors``getRequest``setResponse``cookie` v2`preloadStrategy``modulepreload``path` option (cookie)`@sveltejs/kit/node/polyfills``config.kit.output.linkHeaderPreload``Link` header`@sveltejs/vite-plugin-svelte` v7`page.url``$app/paths` (`base`, `assets`, `resolveRoute`)`Builder` object (`createEntries`)204 responses`Pathname` type`Path` type`Asset` type`AssetPath` type`handle`'s `resolve`Svelte config optionsVite pluginForm action responses`fail``tsconfig``node_modules/$app/tsconfig`CSRF `checkOrigin` option`trustedOrigins``delta` property`popstate` navigation events`form.error` type`App.Error``pragma` header`goto`external URLsSvelte 5.56.4`event.url``event.params``event.route`queries`$service-worker` module`defineEnvVars``@sveltejs/kit/env`server-only directories`$lib` alias`#lib` alias`files.lib` config`preloadData``version.pollInterval`cross-origin form submissions`Content-Type` header`config` (universal route file)`config` (server route file)Vite 8Vite hook filtersVite environment API`data-sveltekit-*` optiontracinginstrumentation flag`kit.paths.origin` config option`kit.prerender.origin``adapter-node` `ORIGIN` environment variable`$app/stores``refreshAll``invalidateAll``*.remote.ts/js` files`experimental.remoteFunctions``noScroll` option (goto)`keepFocus` option (goto)`reset` option (goto)`data-sveltekit-noscroll` attribute`data-sveltekit-keepfocus` attribute`data-sveltekit-reset` attribute`invalidate(All)`special filename patterns`handleError`CORS handlingstatic directory requestsdevelopment`vite@^8.0.12``rolldown` 1.0.0`RouteId``+page``+server`Node 22.17`error(status, {...})``error(status, message, {...})`external redirectsparam files in folder`params.js/ts` file`preloadCode`route ID`paths.base`live queries`builder.compress``tsconfig` exclusionservice workerremote form fieldsform.fields.foo.as(...)environment variablesfunction validators`type: 'module'`service worker registrationsshallow routing`goto``pushState``replaceState``$app/paths`service workers`goto(..., { state, persistState: true })`reloads`$env/static/private``$env/dynamic/private``$env/static/public``$env/dynamic/public``$app/environment``$app/env/private``$app/env/public``$app/env``$app/manifest``immutable``assets``prerendered``routes``page` (boolean)`endpoint` (boolean)`ManifestRoute` type`$app/service-worker` moduleVite config `root` option`process.cwd()`monorepo configurationsVitest workspaces`PageRouteId``EndpointRouteId``$app/types``dirty()` propertyform fields`Response` helpersplatform-provided alternatives`cookies.parse` method`page.state``transport` hooksecure cookie defaultdevelopmentproxying requests`content-encoding` headerglobal app statemodule graph reloads`Path` typesoptional paramsrest paramsmultiple params in one segmentescape sequencesundefined valuesform field `.as(...)`callable standard schemasfunction param matchersnumeric character referencesprerendered pagesqueries refreshed from within another queryserialized responsemalformed streamed data encodingdefault cookie header parseallocations`cookies.get`deleted cookies`cookies.getAll()`stack tracesinternal errors404sCSP directive hand
⚡ Deprecations
- Deprecated `invalidateAll` in favor of `refreshAll`.
- Deprecated `pushState` and `replaceState` in favor of shallow routing in `goto`.
- Reinstated `$env/static/private`, `$env/dynamic/private`, `$env/static/public`, `$env/dynamic/public` and `$app/environment` as deprecated aliases for `$app/env/private` `$app/env/public` and `$app/env`.
- Deprecated `builder.rimraf` and `builder.mkdirp` in favour of `node:fs` methods.
- Deprecated `Response` helpers in favor of platform-provided alternatives.
- Deprecated `error(status, {...})` in favour of `error(status, message, {...})`.