npm / nitropack
nitropack
What changed in nitropack 2 to 22, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.
44 breaking2 security7 deprecations4 new APIs and options4 behavior and defaults
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initnitropack 2259 changes
Breaking changes 44
Bundled app config support and runtime useAppConfig() access are removed; use a regular server-side TypeScript file and import it directly.
The aws_amplify preset now defaults its compute runtime to nodejs22.x instead of nodejs20.x.
The preset now deploys with the Azure Functions Node.js v4 programming model and requires @azure/functions v4; functionsVersion: 3 retains the legacy model.
The renamed build hook runs across Rollup, Rolldown, and Vite and receives builder plus the relevant bundler config.
The deprecated event field is removed from the email runtime hook; use message instead.
Generated _redirects files no longer prefix baseURL onto relative redirect targets; include the base URL in targets when needed.
The deprecated event field is removed from the queue runtime hook; use batch instead.
db0 is no longer a Nitro dependency and is resolved from the project and installed on demand when database features are used.
defineNitroErrorHandler is renamed to defineErrorHandler and is imported from nitro.
lazyEventHandler is renamed to defineLazyEventHandler.
defineNitroPlugin is renamed to definePlugin and imported from nitro.
devStorage is replaced by kv inside $development; add it to $prerender as well if devStorage was used while prerendering.
Read the current request's route rules from event.context.routeRules; use getRouteRules(method, pathname).routeRules for another path.
H3 v2 uses web-standard Request primitives; event.web is renamed to event.req, and event.node.req/res are available only in Node.js runtime.
Cloudflare runtime context and bindings are accessed through event.req.runtime.cloudflare instead of event.context.cloudflare.
The future.nativeSWR option is removed; use the isr route rule where Vercel ISR was intended.
getBuildInfo now accepts an options object, so pass { rootDir } instead of rootDir directly.
H3 uses standard web Headers; values are plain strings, and request and response headers are accessed through event.req.headers and event.res.headers.
Use HTTPError and throw it in place of createError; HTTPError.isError replaces isError.
Auto-imports and the imports option are removed; utilities, server/utils exports, and #imports must be imported explicitly.
The virtual #imports module is no longer available; use explicit imports for utilities.
The netlify_edge preset now writes edge functions to .netlify/v1/edge-functions instead of .netlify/edge-functions.
The netlify preset now writes server functions to .netlify/v1/functions instead of .netlify/functions-internal.
netlify.images is removed; configure images under netlify.config.images.
Use nitro/builder in place of the removed nitropack/rollup and nitropack/core subpaths.
The replacement nitro/meta subpath exports only version, runtimeDir, and runtimeDependencies.
Nitro types are now exported only from nitro/types.
The package is renamed to nitro; update dependencies and imports that reference nitropack.
The experimental kit subpath is removed; use NitroModule from nitro/types instead of defineNitroModule from the kit.
The nitropack/presets subpath is removed; prefer built-in Nitro presets.
The node preset now builds a standalone server; use node_middleware to retain the former reusable middleware output.
Nitro now requires Node.js 22.22.0 or higher, so local, CI/CD, and hosting runtimes must be upgraded.
The prerender.retry option is removed because it had no effect in v3.
Handlers should explicitly return response bodies, streams, redirects, or no-content responses, or throw errors, rather than using the old send helpers.
The old hook name remains as a deprecated alias; calling it with nitro.hooks.callHook() no longer runs hooks.
Scanned file names with reserved trailing lowercase suffixes fail builds or are skipped in dev; add a suffix to scanSuffixes to preserve it as part of the name.
Cloudflare Durable Objects, Workflows, and other classes are now exported from server.ts rather than exports.cloudflare.ts or cloudflare.exports.
Directory scanning is opt-in because serverDir now defaults to false; set it to a path or true to register scanned routes, middleware, plugins, and tasks.
Test files and type declarations are no longer registered during scanning.
unstorage is no longer a Nitro dependency and is resolved from the project and installed on demand when KV or storage features are used.
Use vercel.functions.regions instead of the removed vercel.regions option.
Vite plugin services, assetsImport, and serverReload options move from experimental.vite to the top-level vite option.
ViteServiceConfig replaces the removed deprecated ServiceConfig type.
useBase is renamed to withBase.
Deprecations 7
The preset is merged into cloudflare_module; it still works but logs a deprecation warning.
experimental.vite still works for these options but is deprecated.
nitro/storage is renamed to nitro/kv; the old subpath remains as a deprecated alias for now.
Route rule shapes now use h3-rules; RouteRuleConfig and NormalizedRouteRules replace the deprecated NitroRouteConfig and NitroRouteRules types.
srcDir is deprecated in favor of serverDir; it still works but logs a warning.
The storage config option is renamed to kv; the old name remains as a deprecated alias.
useStorage is renamed to useKV; the old name remains as a deprecated alias for now.
New APIs and options 4
Cached functions and handlers now use in-memory LRU storage by default; configure cache.driver as memory, fs, or kv to choose storage.
Use defineHandler from nitro in place of H3's eventHandler and defineEventHandler.
Use serverFetch from nitro to make internal requests to the server, replacing the useNitroApp().localFetch pattern.
useNitroHooks() guarantees a hooks instance when used outside Nitro plugins, where useNitroApp().hooks might be undefined.
Behavior and default changes 4
The builder is resolved from the project and installed on demand; without rolldown, nitro dev runs server sources without a builder.
Cloudflare development always uses the cloudflare-dev preset with Miniflare emulation and bindings, regardless of compatibilityDate.
On Vercel, only the isr route rule configures ISR; swr and cache rules use Nitro's built-in caching layer.
The Vercel preset always generates observability routes, regardless of compatibilityDate.
nitropack 22 changes
Security 2
Nitro has an Open Redirect via Protocol-Relative URL Bypass in Wildcard Route Rules
Proxy route rules reject out-of-scope requests, addressing a medium-severity vulnerability.