๐ฆ New builders: Bun, Rspack and Rsbuild
In addition to Rolldown, Rollup and Vite, Nitro can now build your server with three new experimental builders:
| Builder | Use it with |
|---|---|
| Bun (#4987) | bun --bun nitro build (selected automatically on Bun when rolldown/vite are not installed)
|
| Rspack (#4942) | builder: "rspack" or NITRO_BUILDER=rspack
|
| Rsbuild (#5011) | the nitro() plugin from nitro/rsbuild in rsbuild.config.ts
|
All builders run the same Rollup-compatible plugins: Nitro's own, your buildPlugins and the ones presets add. So all Nitro features and deployment presets work with each builder.
โก Bun builder
bun --bun nitro buildThe Bun builder bundles with Bun.build. It works with any preset (not only bun) and with nitro dev. Pass extra options with the new bunConfig option.
๐ฆ Rspack builder
export default defineConfig({ builder: "rspack" });The Rspack builder bundles the server with Rspack v2.3+. Like rolldown and vite, @rspack/core is installed on demand. It is not a dependency of Nitro. Load and transform filters become native Rspack loader conditions, so less work goes through JS. There is also a new rspack template for nitro create.
๐งฉ nitro/rsbuild plugin
import { defineConfig } from "@rsbuild/core";
import { nitro } from "nitro/rsbuild";
export default defineConfig({
plugins: [nitro()],
});This plugin works like nitro/vite, using the environments API of Rsbuild. Client, SSR and the Nitro server compile in one Rsbuild compiler. rsbuild dev, build, build --watch and preview work with Nitro, as do SSR outlets in the HTML template, ?assets imports and services. It also works with environments from other plugins, for example TanStack Start (@tanstack/react-start/plugin/rsbuild). ๐ Rsbuild docs ยท examples: rsbuild-ssr-html, rsbuild-ssr-react, rsbuild-ssr-tss-react
Note
These builders are experimental: their behavior may change in minor releases. Known limits are listed in each PR. For example, emitFile only supports assets, and with Bun, library chunks are not grouped.
๐ Shared services + fetchService() (#5023)
Services are now part of Nitro core, with the same config and runtime API for nitro/vite and nitro/rsbuild:
export default defineConfig({
services: { api: { entry: "./src/api-entry.ts" } },
});import { fetchService } from "nitro/services";
const res = await fetchService("api", "/hello");An ssr service is detected from an entry-server file. Your HTML template can render <!--ssr-outlet--> and use fetchService in its context. vite.services and fetchViteEnv() keep working as deprecated aliases.
๐งฑ Renderer templates compiled at build time (#5019)
The renderer template is now compiled at build time, in dev and production, with all builders. Templates are no longer evaluated at runtime (new Function), so template syntax works in dev on workerd/Cloudflare too (#5014). Syntax errors name the template file. With Vite dev, page requests no longer wait for transformIndexHtml (~306 ms โ ~3 ms per page request in a benchmark with a slow HTML plugin). This release also fixes fetchViteEnv is not defined during prerendering.
โก Vite integration
- Built-in
?assetsimports (#5013):?assetsimports are now built into Nitro, based on the original work by Hiroshi Ogawa (@hi-ogawa).nitro/rsbuildsupports them too. - Vite
baseโ NitrobaseURL(#5022):vite build --base /app/now serves routes and assets under/app/. Without a Vitebase, NitrobaseURLis used as the Vitebase. AbaseURLset explicitly in Nitro config always wins. - Missing hashed assets return a
no-store404 (#5020): A request for an old chunk during a deploy no longer gets the HTML page with an immutable one-year cache header.
Important
Behavior changes: Server routes under the client assetsDir (/assets/ by default) now return 404 in production builds. With only a Vite base set, dev now matches production. Set baseURL: "/" to keep the server at the root.
๐ Enhancements
- Experimental
bunbuilder (#4987) - Experimental
rspackbuilder (#4942) - Shared
servicesin core withfetchServicefromnitro/services(#5023) - Experimental
nitro/rsbuildplugin (#5011)
๐ฉน Fixes
- dev: Compile renderer template with workerd eval binding (#5014)
- vite: Return
no-store404 for missing hashed client assets (#5020) - vite: Use vite
baseas nitrobaseURLand vice versa (#5022)
๐ Refactors
๐ Documentation
- Remove nightly-only mentions (1d39bf2b)
Preset Changes
- vercel: Run scheduled tasks with vercel schedules (experimental) (#4756)
- vercel: Invoke path schedules with
GET(#5010)