Skip to content

Commit 1e0c12b

Browse files
committed
fix(config): prepend bun export condition under bun runtime
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
1 parent feebdc1 commit 1e0c12b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/config/resolvers/export-conditions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ function _resolveExportConditions(
2121
}
2222

2323
if (opts.node) {
24+
if ("Bun" in globalThis) {
25+
conditions.push("bun");
26+
}
2427
conditions.push("node");
2528
}
2629

0 commit comments

Comments
 (0)