github nitrojs/nitro v3.0.1-alpha.2

10 hours ago

πŸ”‹ This release contains many improvements since the alpha.1 release.

⏳ We took extra time to ensure everything works well by testing against real-world projects using Nitro v3.

🎯 We are closer to Beta now. Expect more regular v3 releases!

πŸ’¬ Join the Nitro Discord for discussions and to report any issues you encounter with Nitro v3 alpha.

🌟 What’s new?

πŸ”₯ Rolldown-optimized

We optimized all internal and built-in Nitro plugins and configurations for first-class Rolldown support. We recommend that everyone migrate to rolldown and vite@beta, powered by rolldown.

Tip

Upgrade to the latest Nitro v3 with vite@beta (rolldown) and enjoy a seriously mind-blowing performance boost πŸš€

πŸ“¦ Dependencies are bundled by default

Nitro always generates an optimized and portable build output, containing all of your production dependencies.

Previously, all dependencies were copied (traced) into .output/server/node_modules unless configured to be inlined (bundled).

After adopting Rolldown, we found that bundling produces a more optimized and predictable output, but also is WAY faster to bundle dependencies with Rolldown rather than tracing (copying) them. Nitro now bundles dependencies by default using Rolldown (or Rollup).

Nitro has a built-in list of known dependencies with native Node.js bindings or incompatibilities. Only those dependencies are traced.

Tip

If you need to trace additional dependencies that are incompatible with bundling, use the new traceDeps: [] config option to mark them as traced.

βš› React Server Components Support

Thanks to @hi-ogawa, you can now use Nitro with @vitejs/plugin-rsc.

Tip

Cheeckout vite-rsc example for demo.

⬆️ Migration

We have added an experimental feature to support path aliases from tsconfig.json. The experimental flag is now disabled by default.

With vite@beta, you can use rolldown's native support:

import { defineConfig } from "vite"; 
import { nitro } from "nitro/vite";

export default defineConfig({
  plugins: [ nitro({ serverDir: "./server" })],
  resolve: { tsconfigPaths: true } // requires vite@beta
});

Changes

⚠️ Behavior Changes

  • Resolve virtual templates with single plugin (#3819)
  • Remove nodeModulesDirs (#3798)
  • Overhaul externals support (#3799)
  • Opt-in experimental.tsconfigPaths (#3859)
  • Remove nitro/deps/* (#3878)

πŸš€ Enhancements

  • Enable native WASM support by default (#3781)
  • Add manifest.deploymentId (#3792)
  • vercel: Support skew protection (#3787)
  • Export ServerRequest from nitro/types (#3785)
  • netlify.config options namespace (#3794)
  • Add serverEntry config (#3795)
  • _lib chunks (#3849)
  • cloudflare: Support exports.cloudflare.ts (#3834)
  • Mock runtime virtual imports (#3861)
  • Support renderer: false config (#3822)
  • Allow custom ignore patterns for public assets (#3883)
  • vite: Experimental React Server Components (RSC) support (#3919)
  • Automatically trace known native packages (#3923)
  • vite: Auto-register server consumer environments as services (#3928)
  • cloudflare: Always augment request with cf context (#3904)
  • vercel, netlify, cloudflare: Support req.ip (#3952, #3946)
  • Support rolldownConfig (#3887)

πŸ”₯ Performance

  • Resolve virtual templates with a single plugin (#3819)
  • Use filters for plugin hooks (#3820)
  • Remove nodeModulesDirs (#3798)
  • Disable externals if there is no include pattern (b407ed68)
  • vite: Add filter hooks for virtual imports (effb2c6b)
  • Reduce virtual dep plugin impact (#3879)
  • vite: Patch assets plugin for hook filters (8872365b)
  • rolldown: Improve tree-shaking (ced5469f)
  • Lazy import unimport (e20c92d9)
  • Process static assets in parallel (#3911)

🩹 Fixes

  • vite: Detect when SSR entry points to same file as server entry (#3796)
  • deno: Always mark node: imports as external (1d48539f)
  • raw: Generate simple sourcemap (87e718da)
  • vite: Improve dev middleware (#3804)
  • vite: Skip nitro middleware on mounted paths (#3805)
  • aws-lambda-streaming: Handle empty body (#3814)
  • vite: Skip early dev handler for special prefixes (#3817)
  • rolldown: Log dev build errors (e08dbb32)
  • Update oxc-transform import (6382d116)
  • rolldown: Set platform config (cd142cc3)
  • vite: Remove bundler conditions for externalConditions (28aa37cd)
  • vite: Remove custom noExternal for server envs (d34a0450)
  • vite: Temporary workaround for react bundling (9b276e11)
  • dev: Remove transfer-encoding header from worker (33acd73f)
  • vercel: Handle ISR requests with passQuery: true (#3851)
  • Properly compile wildcard only optimized route rule (22a293c5)
  • Update import to nitro/meta (8039866b)
  • Externals windows paths (4d2e6b8a)
  • Handle oxc transform errors (4754f28d)
  • Virtual routes (#3862)
  • Cache nitro app instance in global (c3761400)
  • app: Unique prerender app id (1b1bcec7)
  • app: Improve instance caching (23a6c8f8)
  • app: Isolate instance per build (2e108f51)
  • task: Use http.request to support socketPath in dev fetch (#3268)
  • cli: Respect devServer config (#3881)
  • Handle void hook result (7f42bc15)
  • Use module condition and main fields for bundling (#3886)
  • Cache rou3 compilation by options hash (#3890)
  • openapi: Only filter undefined from array nodes (#3894)
  • vite: Kill prerenderer child process when the vite preview server closes (#3907)
  • vite: Wait on preview child port to be ready (#3908)
  • vite: Trap unhandled errors in worker (301604f8)
  • dev: Respect opts.json when false for error handler (#3920)
  • vercel: Add preview command (#3921)
  • Collect errors in utils/parallel (#3933)
  • Force trace pg dependency (0e06c714)
  • Avoid naming node_modules/.* as lib chunk (22bd0c63)
  • Use static replacement for websocket feature (#3964)

πŸ’… Refactors

  • Improve output chunk names (#3780)
  • Overhaul externals support (#3799)
  • Env runners (#3836)
  • Update nf3 usage (c1bca694)
  • vite: Keep SSR bundle external dependencies (#3854)
  • Opt-in experimental.tsconfigPaths (#3859)
  • Use internal #runtime subpath import (#3860)
  • Move silent warn codes to shared config (0939a38d)
  • vite@8 support (#3867)
  • Improve VFS (#3877)
  • vite: Remove experimental VFS for now (ba755e6a)
  • types: Avoid DeepPartial (#3888)
  • Update assets plugin for better tree shake (#3891)
  • rolldown: Migrate to codeSplitting config (02475fa0)
  • Include name of hoisted libs in chunk name (#3962)

πŸ“– Documentation

  • Update plugins section (#3793)
  • Add serverDir (#3812)
  • nightly: Mention bun.lock for lockfile (#3816)
  • vercel: Fix ISR wording (#3845)
  • v3: Add versions menu (#3856)
  • Update defineNitroPlugin references (#3857)
  • v3: Set branch name (#3864)
  • cloudflare: Update local bindings section (#3865)
  • routing: Update error handling description (#3564)
  • Update runtime config usage (#3885)
  • runtime-config: Emphasize NITRO_ env prefix requirement (#3906)
  • nightly: Add note about bun package manager (#3960)

❀️ Contributors

Don't miss a new nitro release

NewReleases is sending notifications on new releases.