π 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
ServerRequestfromnitro/types (#3785) netlify.configoptions namespace (#3794)- Add
serverEntryconfig (#3795) _libchunks (#3849)- cloudflare: Support
exports.cloudflare.ts(#3834) - Mock runtime virtual imports (#3861)
- Support
renderer: falseconfig (#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
cfcontext (#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-transformimport (6382d116) - rolldown: Set
platformconfig (cd142cc3) - vite: Remove bundler conditions for
externalConditions(28aa37cd) - vite: Remove custom
noExternalfor server envs (d34a0450) - vite: Temporary workaround for react bundling (9b276e11)
- dev: Remove
transfer-encodingheader 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.requestto supportsocketPathin dev fetch (#3268) - cli: Respect
devServerconfig (#3881) - Handle void hook result (7f42bc15)
- Use
modulecondition andmainfields for bundling (#3886) - Cache
rou3compilation by options hash (#3890) - openapi: Only filter
undefinedfrom 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.jsonwhenfalsefor error handler (#3920) - vercel: Add preview command (#3921)
- Collect errors in utils/parallel (#3933)
- Force trace
pgdependency (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
nf3usage (c1bca694) - vite: Keep SSR bundle external dependencies (#3854)
- Opt-in
experimental.tsconfigPaths(#3859) - Use internal
#runtimesubpath import (#3860) - Move silent warn codes to shared config (0939a38d)
vite@8support (#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.lockfor lockfile (#3816) - vercel: Fix ISR wording (#3845)
- v3: Add versions menu (#3856)
- Update
defineNitroPluginreferences (#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
- Pooya Parsa (@pi0)
- Huseeiin (@huseeiin)
- Emre TINAZTEPE (@emretinaztepe)
- Dmitry Istomin (@tirojal)
- Manuel Schiller manuel.schiller@caligano.de
- Hiroshi Ogawa (@hi-ogawa)
- Daniel Roe (@danielroe)
- Jamaluddin Rumi (@jamaluddinrumi)
- Abeer0 (@iiio2)
- Kricsleo (@kricsleo)
- Teena (@franklin-tina)
- Azrikahar (@azrikahar)
- Restent Ou (@gxres042)
- SΓ©bastien Chopin (@atinux)
- Seven Du (@medz)
- Florian Streise (@fmoessle)
- Taylor Steele (@taylorfsteele)
- Mick Lawitzke (@MickL)
- Btea (@btea)
- Niels Mentink
- Windwiny
- Nicolai Bruhn