Skip to content

Releases: nitrojs/nitro

v2.11.6

08 Mar 23:19
@pi0 pi0
Compare
Choose a tag to compare

compare changes

🩹 Fixes

  • Update unenv and cloudflare node compat (#3187) (unenv rc.13 + rc.14)
  • dev: Use port for bun on windows (#3188)

💅 Refactors

  • Remove extra space in logs (#3181)
  • Remove dependency on unenv mock utils (#3186)

📖 Documentation

  • deploy: Add warning about turborepo and zero config (#3182)
  • Minor fixes (#3183, #3184)

❤️ Contributors

v2.11.5

07 Mar 13:15
@pi0 pi0
231c516
Compare
Choose a tag to compare

compare changes

🩹 Fixes

  • dev: Use abstract sockets on linux with node.js >=20 (#3178)
  • dev: Use os tmp dir for unix sockets (#3179)

📦 Build

  • Use upstream youch back (#3175)

🌊 Types

  • Mark $global optional for NitroRouteMeta (#3174)

❤️ Contributors

  • Pooya Parsa
  • Léo Pradel

v2.11.4

07 Mar 01:29
@pi0 pi0
Compare
Choose a tag to compare

compare changes

🩹 Fixes

  • dev: Auto fallback to port if socket listening failed (#3165)
  • dev: Try normal socket for CI (a4569493)
  • dev: Polyfill globalThis.crypto for Node.js 18 (#3166, #3168)
  • cli: Add globalThis.crypto polyfill for Node.js 18 (#3167)

📦 Build

  • Use youch-redist (#3172)

v2.11.3

06 Mar 12:33
@pi0 pi0
Compare
Choose a tag to compare

compare changes

  • cloudflare: Support wrangler.jsonc (#3162)
  • Expose default error to custom handler (#3161)
  • Only show force close warn in debug mode (06147e7a)

v2.11.2

05 Mar 22:54
@pi0 pi0
Compare
Choose a tag to compare

compare changes

🩹 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

v2.11.1

05 Mar 12:19
@pi0 pi0
c9d1032
Compare
Choose a tag to compare

compare changes

🩹 Fixes

  • dev: Use full socket path for windows and linux (#3152)
  • dev: Add random number to socket name (#3153)
  • dev: Limit /_vfs to local ips only (#3154)
  • app: Update event before calling request hook (#3155)

❤️ Contributors

v2.11.0

04 Mar 19:05
@pi0 pi0
Compare
Choose a tag to compare

💬 Release Discussion

🌟 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:

image image
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:

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.

  • unenv upgraded to v2 (full rewrite).
  • db0 upgraded to v0.3 (ESM-only, native node:sql, improvements).
  • ohash upgraded to v2 ...
Read more

v2.10.4

08 Nov 11:57
@pi0 pi0
18508dc
Compare
Choose a tag to compare

compare changes

🔥 Performance

  • raw: Avoid extra this.resolve when possible (#2857)

📖 Documentation

  • config: Tiny typos (#2859)

❤️ Contributors

v2.10.3

05 Nov 20:50
@pi0 pi0
Compare
Choose a tag to compare

compare changes

🩹 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

v2.10.2

03 Nov 12:44
@pi0 pi0
Compare
Choose a tag to compare

compare changes

🩹 Fixes

  • rollup: Pass options to resolve (#2842)

📖 Documentation

  • cloudflare: Update cloudflare-module (#2831)
  • Update nightly and experimental banners (9ff37139)

❤️ Contributors