npm / @sveltejs/kit
@sveltejs/kit
What changed in @sveltejs/kit 2 to 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
80 breaking13 security8 deprecations28 new APIs and options8 behavior and defaults5 tooling35 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@sveltejs/kit 3166 changes
Breaking changes 80
204 responses now return no content.
Adapter Vite plugins are separated into
preandpost.ActionResultandSubmitFunctionmove from@sveltejs/kitto$app/forms.Navigation-related types, including
GotoOptions, move from@sveltejs/kitto$app/navigation.The
base,assets, andresolveRouteexports are removed from$app/paths.Remote function types move to
$app/server.Page,ReadonlyURL, andReadonlyURLSearchParamsmove from@sveltejs/kitto$app/state.The
$app/storesmodule is removed.The type is renamed from
AssettoAssetPath; leading/is removed fromAssetPathvalues.createEntriesis removed from theBuilderobject passed to adapter functions.builder.generateManifestis replaced withbuilder.generateServerInstanceandbuilder.manifest.The deprecated CSRF option is removed in favor of
trustedOrigins.A
configexported from a universal route file takes precedence over one exported from a server route file.The cookie dependency is upgraded to v2, which requires cookie names to contain only ASCII characters.
The cookie
pathoption now defaults to/.Cross-origin form submissions without a
Content-Typeheader are disallowed.Enhanced cross-page form actions navigate to the action page on success and failure, matching native form behavior.
Clicking a link to the current URL refreshes all load functions and queries.
The option value
offis removed in favor offalse.The
data-sveltekit-noscrollanddata-sveltekit-keepfocusattributes are replaced bydata-sveltekit-reset.The
experimental.handleRenderingErrorsflag is removed.External redirects are forbidden by default.
Form action responses now use the HTTP status code returned from
fail.The type changes from
anytoApp.Error | undefined.getRequestis now synchronous.gotorejects when given a URL that does not resolve to a route within the app.The
noScrollandkeepFocusoptions are replaced by theresetoption.handle'sresolveis now typed to always return aPromise.All errors now pass through the
handleErrorhook.handleErrorcan influence the status code.handleValidationErroris removed; remote function validation errors are passed tohandleErrorwithkind: 'validation'.HEADrequests are answered without a response body.Environment variables are populated before
instrumentation.server.jsis evaluated, and the adapter instrumentation API is updated.Calling
invalidateorinvalidateAllduring navigation no longer aborts navigation.Adds
kit.paths.origin;kit.prerender.originand theadapter-nodeORIGINenvironment variable are removed.The
$libalias is replaced with#lib, andfiles.libconfiguration is removed.The
#libdefinition is removed frompaths, requiring explicit module extensions.The deprecated
.run()method is removed from live queries.The
deltaproperty now exists only forpopstatenavigation events.The generated tsconfig is now written to
node_modules/$app/tsconfig.Node 22.17 or newer is required.
page.urlis immutable at the type level.Param files in folders are removed in favor of a
params.js/tsfile.The type is renamed from
PathnametoPath; leading/is removed fromPathvalues.The deprecated
pragmaheader is removed from version polling for improved CORS support.preloadCodetakes a route ID instead of a pathname; route IDs are not prefixed withpaths.base.The result type for
preloadDatanow includes anerrorresult.The option is removed;
modulepreloadis always used.Fallback handlers are rejected on prerendered endpoints.
Programmatic form validation skips clean fields.
Accessing
event.url,event.params, orevent.routeinside queries now errors.Values set or refreshed from within a query during SSR are serialized into the rendered HTML.
Submitting a remote form without JavaScript preserves the current URL search parameters.
These files are disallowed unless
experimental.remoteFunctionsis enabled.Route ID escape sequences are expanded when resolving a route ID to a pathname.
RouteIdincludes only routes with a+pageor+serverfile.The
Serverconstructor is removed from public types.Nested server-only directories are supported, and
/server/paths are treated as server-only throughout the project except insrc/routesand the assets directory.Server-side self-fetch fallbacks no longer follow redirects.
The
$service-workermodule is deleted.Service worker registrations use
type: 'module'.setResponseis now synchronous.The server errors if it does not respect a client-requested single-flight mutation, and can explicitly ignore refreshes.
SSRManifestis removed from public types.Subresource requests receive a lightweight 404 instead of rendering the error page.
Svelte 5.56.4 or newer is required.
Svelte config options must be passed through the Vite plugin.
defineEnvVarsmoves to@sveltejs/kit/env.Environment-related types move to
@sveltejs/kit/env.Hooks-related types move to
@sveltejs/kit/hooks.The
@sveltejs/kit/node/polyfillsmodule is removed.defineParamsand its associated types move to@sveltejs/kit/params.Version 7 is required.
Tracing moves out of the experimental namespace, and the instrumentation flag is removed.
Load functions rerun when the number of values of a tracked search parameter changes.
TypeScript 6 is now the minimum required version.
The experimental remote form option
includeUntouchedis replaced byall.The default polling interval is now one hour; deployment detection also occurs on data, remote, and form action responses, tab focus, and visibility changes.
Vite 8 is required; its hook filters and environment API also enable faster builds and more powerful adapters.
Query parameters beginning with
x-sveltekit-are rejected.
Security 2
Path traversal is prevented when previewing prerendered pages and data on Windows.
Nested and typed underscore-prefixed remote form fields are redacted after invalid submissions.
Deprecations 8
The
aliasoption is deprecated.builder.mkdirpis deprecated in favor ofnode:fsmethods.builder.rimrafis deprecated in favor ofnode:fsmethods.The environment modules are reinstated as deprecated aliases for
$app/env/private,$app/env/public, and$app/env.error(status, {...})is deprecated in favor oferror(status, message, {...}).Response helpers are deprecated in favor of platform-provided alternatives.
Serveris deprecated in favour of theserverobject written bybuilder.generateServerInstance.export const snapshotis deprecated in favor of thesnapshothelper.
New APIs and options 28
CSP hash-reporting keyword is supported.
CSP hash-reporting keyword is supported.
CSP hash-reporting keyword is supported.
A
sveltekit.endpointspan is emitted for+serverhandlers when server tracing is enabled.Adapters can provide additional Vite plugins and receive the Svelte config as a function argument when adding them.
Adds
$app/manifestwithimmutable,assets,prerendered, androutesexports.$app/pathscan be imported in service workers.Adds the
$app/service-workermodule.Adds an
applyReroutehelper for adapters supporting split serverless function deployments.Adds an option to preload using the
Linkheader.Adds the
cookies.parsemethod.Adds
PageRouteIdandEndpointRouteIdto$app/types.Function validators are supported for environment variables.
Remote form fields gain a
touched()helper.Adds a
dirty()property to form fields.The checked state can be passed as a third argument to
.as('radio', ...)and.as('checkbox', ...), so inputs reset to that state after submission.A new
responseoption letsgetRequestabortrequest.signalwhen a response closes prematurely.Adapters can override
getRequestandsetResponseduringvite devandvite preview.Page state set through
goto(..., { state, persistState: true })is preserved across reloads.Adds shallow routing to
goto;pushStateandreplaceStateare deprecated.Adds
ManifestRouteandpageandendpointbooleans to$app/manifestroutes.Custom values in
page.stateare supported through thetransporthook.Adds
PageRouteIdandEndpointRouteIdto$app/types.The font preload filter receives the project-relative source
filename.The
QUERYHTTP method is supported in+server.js.refreshAllis added, andinvalidateAllis deprecated.Remote form fields are widened to support union schemas and string enums.
Adds the
snapshothelper to$app/navigation.
Behavior and default changes 8
builder.compressreturns the list of compressed files.Cookies default to
secure: falseduring development.Hyphens are allowed in param and matcher names.
When a query value arrives through
set(), its pending request is settled in place.All pending query promises are rejected when a query fails before first resolving with a value.
Remote function exports may use reserved words such as
deleteandclass.Routes can contain
[and]using the[x+5b]and[x+5d]escapes.Pages render over sibling endpoints that have no
GETorHEADhandlers.
Tooling 5
Generated files are left unchanged when their contents have not changed.
$app/tsconfigcan be generated without TypeScript installed.Adds
ErrorPropsto generated types.Prerender errors are surfaced during development.
Sourcemaps are supported in production.
Fixes and other changes 35
Deployment recovery continues when service worker updates fail.
Focus remains in the parent page when an app in an unfocused iframe starts or navigates.
MIME types for prerendered files are inferred from generated files.
Modules are no longer all treated as server-only when the project is inside a
serverdirectory.Warnings are no longer emitted for Storybook's Vite plugins that use
transformIndexHtml.Relative imports in generated types now work with nodenext module resolution.
Dynamic
$app/env/*variables are populated in contexts that do not run the dev server, such asvite-node.$app/environmentis restored as an alias for$app/envso dependencies importing it continue to work.The error status from
App.Erroris read inprerenderandquery.liveremote functions.Server-side route resolution supports bigint params.
Cookie options are optional.
Deleted cookies are excluded from
cookies.getAll(), keeping it consistent withcookies.get().Fetch responses are no longer serialized when the request body is not a string or TypedArray.
The nearest error page renders when a form submission receives a non-ActionResult error response.
The nearest
+error.svelterenders at its occupied depth when an error is thrown during rendering.Where applicable, form field
.as(...)acceptsundefinedvalues.Form fields can be named after
Objectprototype properties.form.fields.setproperly handlesDateobjects.Reading non-serialized
set-cookieheaders viagetSetCookieinloadno longer errors.Global app state persists across module graph reloads.
The prerender crawler no longer hangs on unterminated unquoted attributes.
User-set
preview.corsconfiguration is respected instead of being overridden.Values set or refreshed from within a query during SSR are serialized into the rendered HTML.
query.livesends periodickeep-aliveSSE comments to prevent idle-timeout errors.data:protocol URLs are treated as external for redirects.Validation checks that all remote form fields were created with
form.fields.foo.as(...).Values typed into remote form fields are coerced, and
.as()defaults apply only until the field is edited.Errors from prerendered remote responses are propagated instead of rerunning the function.
Node.js buffers returned from remote functions during SSR are serialized correctly.
RequestEventproperties are markedreadonly.Route escape sequences above
ffffare decoded correctly.Scheme-like path segments no longer cause off-site trailing-slash redirects.
User-set
server.corsconfiguration is respected instead of being overridden.The trusted-types policy is required only when client-side code is shipped, allowing builds where all pages have
csr: false.Paths resolve using the Vite config
rootoption instead ofprocess.cwd(), improving monorepo support.
@sveltejs/kit 211 changes
Security 11
SvelteKit: ReDoS (O(n^2)) in content negotiation — unauthenticated DoS via the Accept header
SvelteKit: Big remote form function payloads can cause Node process to crash
SvelteKit: Prototype pollution in file input deletion path in remote-function forms
@sveltejs/kit:
query.batchcross-talk@sveltejs/adapter-node has a BODY_SIZE_LIMIT bypass
@sveltejs/kit: Unvalidated redirect in handle hook causes Denial-of-Service
SvelteKit has deserialization expansion in unvalidated
formremote function leading to Denial of Service (experimental only)CPU exhaustion in SvelteKit remote form deserialization (experimental only)
Memory exhaustion in SvelteKit remote form deserialization (experimental only)
@sveltejs/kit has memory amplification DoS vulnerability in Remote Functions binary form deserializer (application/x-sveltekit-formdata)
SvelteKit is vulnerable to denial of service and possible SSRF when using prerendering