Releases: nitrojs/nitro
v2.11.6
v2.11.5
v2.11.4
v2.11.3
v2.11.2
🩹 Fixes
- prerender: Ignore prefixed public assets (#3093)
- dev: Mark event as handled before sending proxy (058819aa, 67c396ba)
- dev: Force close server immediately in test and ci (97ed879a)
- dev: Close all connections when reloading (5b5e10e7)
- config: Respect config overrides for defaults (#3158)
❤️ Contributors
- Pooya Parsa (@pi0)
- Daniel Roe (@danielroe)
v2.11.1
v2.11.0
🌟 What is new?
🟢 Better Errors
Error handlers for both development and production environments have been rewritten (see #3002 for more details).
Powered by poppinss/youch (v4.x), you can now view beautiful error pages with stack traces in both the browser and CLI.
Nitro automatically applies source maps to error stack traces—no need to set NODE_OPTIONS="--enable-source-maps"
—allowing you to pinpoint the exact file and line where an issue occurs.
Previously, Nitro conditionally rendered JSON errors based on certain user-agent
headers or when requests were made to /api/*
.
For more consistent behavior, any request not made from a browser (i.e., without the Accept: text/html
header) will always receive a JSON response. Additionally, all production errors are now returned in JSON format.
You can still override the error handler for both development and production using the errorHandler
config. If you want to fall back to the default error handler conditionally, you can simply return
without handling the response (see #3085 for more details).
Additional strict security headers will be always added to error responses (#2907).
Example error in development:
![]() |
![]() |
Example error in production
{
"error": true,
"url": "http://localhost:3000/",
"statusCode": 500,
"statusMessage": "Server Error",
"message": "Server Error",
"data": {
"foo": "bar"
}
}
🟢 Better Dev Server
Every time you run the nitro dev
or nuxt dev
command, Nitro creates an isolated worker thread and proxies requests from the browser to the server inside the worker using a Unix socket or a named pipe on Windows.
To improve stability and provide a better experience, the internal mechanism for creating and reloading the server and handling errors has been rewritten (see #3135 for more details).
🟢 Database Improvements
Nitro's database support, powered by db0 0.3.x, now offers improved types, better-prepared statements, better API consistency, and native node:sqlite
support (#3127).
Thanks to native node:sqlite support in Node.js (>= 22.5.0) and Deno (>= 2.2), you can now use databases in both environments without external dependencies or extra configuration!
🟢 Improved baseURL
Handling
For deployments that need to be served under a base URL (e.g., /admin
), Nitro provides a baseURL
config. When enabled, all routes and static assets will be prefixed accordingly.
Depending on the deployment platform, the build output structure may need to be adjusted. The Netlify and Stormkit presets have been updated with fixes (#2966, #2971, 5a51bf06). Additionally, we have enabled baseURL
for nitro-deploys for end-to-end testing.
The new Nitro error handler also improves the user experience. If a request is made to the server without the required base URL, it will now automatically redirect (#3146).
🟢 Prerender Crawler
Nitro's prerender feature includes a crawler that scans each page to discover additional links. However, previous versions relied on regex matches, which occasionally led to false detections.
This release migrates to natemoo-re/ultrahtml for more precise link extraction (#3068).
🟢 Improved Module Resolution
Nitro has migrated to exsolve for internal module resolution. This change improves performance (up to 3x), and stability, and enforces stricter search paths (#3125).
🟢 Firebase App Hosting
Zero-config deployment support for Firebase App Hosting has been added (#2864, #2895, #2967).
🟢 Node.js Compatibility for edge and Deno v2
The Nitro server can be deployed to any runtime and platform. We built unenv and integrated it into Nitro so that if your code or any library you use requires Node.js-specific features such as Buffer, process.env, or setImmediate, they can continue working through automatically injected lightweight polyfills.
Thanks to efforts like WinterCG, the ecosystem has shifted towards using more web standards that work in any JavaScript runtime.
However, some Node.js features remain difficult to replace, such as node:async_hooks, node:crypto, node:net, and even process.env
, which plays a de facto standard role while standards for JavaScript servers continue to evolve.
Edge runtimes (Cloudflare Workers, Deno Deploy, Netlify Edge, and Vercel Edge) are built on top of the V8 engine and traditionally lacked support for Node.js APIs and globals. Thankfully, both Deno (v2) and Cloudflare (workerd) have made significant efforts to support Node.js APIs in their edge runtimes. You can check the status using the unofficial platform-node-compat tests.
This improvement makes Nitro's support for edge runtimes faster, smaller, and more capable. Features like AsyncLocalStorage, which cannot be simply polyfilled, benefit from these new APIs.
While edge platforms have (partially) implemented Node.js APIs, we still need to polyfill any unsupported features using unenv.
Unenv v2 is a major rework with all Node.js modules rewritten as ESM polyfill modules, ensuring full coverage of known exports from the latest Node.js LTS release. With Unenv v2, we can create hybrid/native Node.js polyfills that combine native runtime support with polyfills at the module export level (used for cloudflare presets).
Enabling Node.js compatibility:
- deno-deploy and netlify-edge: Automatically enabled after upgrade for all Node.js APIs (#3129).
- deno-server: Upgrade to Deno v2 and set
compatibilityDate
to2025-01-30
or later (#3050). - vercel-edge (deprecated): Automatically enabled after upgrade for a subset of Node.js APIs (#3136).
- cloudflare: Add
nodejs_compat
to your wrangler configuration. - nuxt-hub: Automatically enabled after upgrading dependencies.
For Cloudflare deployments, we have also added an experimental new method to enable Node.js compatibility, which will be enabled by default in future releases.
Please note that creating a wrangler.toml
file or using deployConfig
flag, disables Cloudflare dashboard features, and variables set from the dashboard will be lost.
Opt-in to cloudflare deploy config
// Nitro
export default defineNitroConfig({
compatibilityDate: "2025-03-01",
cloudflare: { nodeCompat: true, deployConfig: true }
});
// Nuxt
export default defineNuxtConfig({
compatibilityDate: "2025-03-01",
nitro: { cloudflare: { nodeCompat: true, deployConfig: true } }
});
📦 Dependency Upgrades
Several dependencies across unjs have been updated, focusing on performance improvements and an ESM-only dist to reduce install size. This has already reduced the package size by approximately ~28MB
, with further reductions planned as we phase out dual-format published packages.
v2.10.4
🔥 Performance
- raw: Avoid extra
this.resolve
when possible (#2857)
📖 Documentation
- config: Tiny typos (#2859)
❤️ Contributors
- @beer (@iiio2)
- Arkadiusz Sygulski [email protected]
v2.10.3
🩹 Fixes
- Allow adding custom
Vary
to static assets handler (#2835) - netlify: Only include env polyfill in
netlify-edge
(#2851) - Scan env specific handlers without method in their name (#2852)
- config: Add back default storage mounts (#2853)
📖 Documentation
- cloudflare: Fix typo (#2849)
🌊 Types
- cache: Resolved value is not nullable (#2848)
❤️ Contributors
- Pooya Parsa [email protected]
- Sandro Circi (@sandros94)
- Jaga Santagostino [email protected]
- Philippe Serhal [email protected]
- Danila Rodichkin (@daniluk4000)