unstale

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 init

@unstale/cli 0.3.1 on npm

nitropack 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.

    22.0.0upgrade guide

  • The aws_amplify preset now defaults its compute runtime to nodejs22.x instead of nodejs20.x.

    22.0.0upgrade guide

  • The preset now deploys with the Azure Functions Node.js v4 programming model and requires @azure/functions v4; functionsVersion: 3 retains the legacy model.

    22.0.0upgrade guide

  • The renamed build hook runs across Rollup, Rolldown, and Vite and receives builder plus the relevant bundler config.

    22.0.0upgrade guide

  • The deprecated event field is removed from the email runtime hook; use message instead.

    22.0.0upgrade guide

  • Generated _redirects files no longer prefix baseURL onto relative redirect targets; include the base URL in targets when needed.

    22.0.0upgrade guide

  • The deprecated event field is removed from the queue runtime hook; use batch instead.

    22.0.0upgrade guide

  • db0 is no longer a Nitro dependency and is resolved from the project and installed on demand when database features are used.

    22.0.0upgrade guide

  • defineNitroErrorHandler is renamed to defineErrorHandler and is imported from nitro.

    22.0.0upgrade guide

  • lazyEventHandler is renamed to defineLazyEventHandler.

    22.0.0upgrade guide

  • defineNitroPlugin is renamed to definePlugin and imported from nitro.

    22.0.0upgrade guide

  • devStorage is replaced by kv inside $development; add it to $prerender as well if devStorage was used while prerendering.

    22.0.0upgrade guide

  • Read the current request's route rules from event.context.routeRules; use getRouteRules(method, pathname).routeRules for another path.

    22.0.0upgrade guide

  • 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.

    22.0.0upgrade guide

  • Cloudflare runtime context and bindings are accessed through event.req.runtime.cloudflare instead of event.context.cloudflare.

    22.0.0upgrade guide

  • The future.nativeSWR option is removed; use the isr route rule where Vercel ISR was intended.

    22.0.0upgrade guide

  • getBuildInfo now accepts an options object, so pass { rootDir } instead of rootDir directly.

    22.0.0upgrade guide

  • H3 uses standard web Headers; values are plain strings, and request and response headers are accessed through event.req.headers and event.res.headers.

    22.0.0upgrade guide

  • Use HTTPError and throw it in place of createError; HTTPError.isError replaces isError.

    22.0.0upgrade guide

  • Auto-imports and the imports option are removed; utilities, server/utils exports, and #imports must be imported explicitly.

    22.0.0upgrade guide

  • The virtual #imports module is no longer available; use explicit imports for utilities.

    22.0.0upgrade guide

  • The netlify_edge preset now writes edge functions to .netlify/v1/edge-functions instead of .netlify/edge-functions.

    22.0.0upgrade guide

  • The netlify preset now writes server functions to .netlify/v1/functions instead of .netlify/functions-internal.

    22.0.0upgrade guide

  • netlify.images is removed; configure images under netlify.config.images.

    22.0.0upgrade guide

  • Use nitro/builder in place of the removed nitropack/rollup and nitropack/core subpaths.

    22.0.0upgrade guide

  • The replacement nitro/meta subpath exports only version, runtimeDir, and runtimeDependencies.

    22.0.0upgrade guide

  • Nitro types are now exported only from nitro/types.

    22.0.0upgrade guide

  • The package is renamed to nitro; update dependencies and imports that reference nitropack.

    22.0.0upgrade guide

  • The experimental kit subpath is removed; use NitroModule from nitro/types instead of defineNitroModule from the kit.

    22.0.0upgrade guide

  • The nitropack/presets subpath is removed; prefer built-in Nitro presets.

    22.0.0upgrade guide

  • The node preset now builds a standalone server; use node_middleware to retain the former reusable middleware output.

    22.0.0upgrade guide

  • Nitro now requires Node.js 22.22.0 or higher, so local, CI/CD, and hosting runtimes must be upgraded.

    22.0.0upgrade guide

  • The prerender.retry option is removed because it had no effect in v3.

    22.0.0upgrade guide

  • Handlers should explicitly return response bodies, streams, redirects, or no-content responses, or throw errors, rather than using the old send helpers.

    22.0.0upgrade guide

  • The old hook name remains as a deprecated alias; calling it with nitro.hooks.callHook() no longer runs hooks.

    22.0.0upgrade guide

  • 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.

    22.0.0upgrade guide

  • Cloudflare Durable Objects, Workflows, and other classes are now exported from server.ts rather than exports.cloudflare.ts or cloudflare.exports.

    22.0.0upgrade guide

  • 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.

    22.0.0upgrade guide

  • Test files and type declarations are no longer registered during scanning.

    22.0.0upgrade guide

  • unstorage is no longer a Nitro dependency and is resolved from the project and installed on demand when KV or storage features are used.

    22.0.0upgrade guide

  • Use vercel.functions.regions instead of the removed vercel.regions option.

    22.0.0upgrade guide

  • Vite plugin services, assetsImport, and serverReload options move from experimental.vite to the top-level vite option.

    22.0.0upgrade guide

  • ViteServiceConfig replaces the removed deprecated ServiceConfig type.

    22.0.0upgrade guide

  • useBase is renamed to withBase.

    22.0.0upgrade guide

Deprecations 7

  • The preset is merged into cloudflare_module; it still works but logs a deprecation warning.

    22.0.0upgrade guide

  • experimental.vite still works for these options but is deprecated.

    22.0.0upgrade guide

  • nitro/storage is renamed to nitro/kv; the old subpath remains as a deprecated alias for now.

    22.0.0upgrade guide

  • Route rule shapes now use h3-rules; RouteRuleConfig and NormalizedRouteRules replace the deprecated NitroRouteConfig and NitroRouteRules types.

    22.0.0upgrade guide

  • srcDir is deprecated in favor of serverDir; it still works but logs a warning.

    22.0.0upgrade guide

  • The storage config option is renamed to kv; the old name remains as a deprecated alias.

    22.0.0upgrade guide

  • useStorage is renamed to useKV; the old name remains as a deprecated alias for now.

    22.0.0upgrade guide

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.

    22.0.0upgrade guide

  • Use defineHandler from nitro in place of H3's eventHandler and defineEventHandler.

    22.0.0upgrade guide

  • Use serverFetch from nitro to make internal requests to the server, replacing the useNitroApp().localFetch pattern.

    22.0.0upgrade guide

  • useNitroHooks() guarantees a hooks instance when used outside Nitro plugins, where useNitroApp().hooks might be undefined.

    22.0.0upgrade guide

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.

    22.0.0upgrade guide

  • Cloudflare development always uses the cloudflare-dev preset with Miniflare emulation and bindings, regardless of compatibilityDate.

    22.0.0upgrade guide

  • On Vercel, only the isr route rule configures ISR; swr and cache rules use Nitro's built-in caching layer.

    22.0.0upgrade guide

  • The Vercel preset always generates observability routes, regardless of compatibilityDate.

    22.0.0upgrade guide

nitropack 22 changes

Security 2

  • Nitro has an Open Redirect via Protocol-Relative URL Bypass in Wildcard Route Rules

    2.13.4security advisory

  • Proxy route rules reject out-of-scope requests, addressing a medium-severity vulnerability.

    2.13.4security advisory