From 1e0c12bd68d46e4402b5dacc3bf5e0a14f4b38f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?So=CC=84ta?= Date: Sat, 25 Apr 2026 15:11:00 +0200 Subject: [PATCH] fix(config): prepend bun export condition under bun runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running the dev server under `bun --bun`, `_resolveExportConditions` only pushed "node" to Vite's resolve conditions. This caused Vite's ModuleRunner to load srvx's and h3's Node adapters inside the dev worker, returning a srvx `NodeResponse` to `Bun.serve` — which Bun rejects, falling back to its default response and breaking every `/_nitro/*` request with a Parse Error. Detect Bun via `"Bun" in globalThis` (matching the existing pattern in `src/presets/vercel/utils.ts`) and prepend "bun" so it wins for packages declaring both conditions, while keeping "node" for packages that only declare "node". Pure Node setups are unchanged. Closes #4228 --- src/config/resolvers/export-conditions.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/config/resolvers/export-conditions.ts b/src/config/resolvers/export-conditions.ts index 8ea4d0c13f..04a9f1f85d 100644 --- a/src/config/resolvers/export-conditions.ts +++ b/src/config/resolvers/export-conditions.ts @@ -21,6 +21,9 @@ function _resolveExportConditions( } if (opts.node) { + if ("Bun" in globalThis) { + conditions.push("bun"); + } conditions.push("node"); }