fix(vite): respect bun/deno export conditions in dev server#4397
Merged
Conversation
When the Nitro dev server runs under Bun or Deno, the Vite module runner resolved the `node` export condition, so `srvx`'s `FastResponse` became the node adapter's `NodeResponse` wrapper. `Bun.serve`/`Deno.serve` strictly require a native `Response` and reject it, crashing the dev server. Prepend the matching `bun`/`deno` export condition in dev so packages like `srvx` resolve to their runtime-native adapter (native `Response`). `node` stays as a fallback; production builds are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds dev-only export condition selection for Bun and Deno in ChangesDev runtime export conditions
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
…nner Only prepend the host bun/deno condition when the module runner shares the host runtime (default node-worker). Process-based and miniflare runners execute in a different runtime and must not inherit it. Also dedupe runner name resolution into a shared _devRunner() helper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Externalized deps in dev now resolve their bun/deno-native entry too, matching the bundled `conditions` behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The helper runs on all paths (it early-returns outside dev/node-worker), so the `dev` prefix was misleading. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 30, 2026
pi0x
added a commit
that referenced
this pull request
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the Nitro dev server runs under Bun (
bun --bun) or Deno, the Vite module runner resolves thenodeexport condition, so packages are loaded through theirnodeentry instead of their runtime-native one.This PR adds
_devRuntimeConditions(ctx), used by both the Nitro and service environments, to prepend the host runtime's export condition:"bun""deno"Scope
This only applies in dev and only with the default
node-workerrunner, where the module runner executes in a worker thread of the same host runtime (Bun ⇒ Bun, Deno ⇒ Deno).Process-based runners (
bun-process,deno-process,node-process, …) andminiflareexecute in a different runtime than the host, so the host-detected condition is intentionally not applied to them — otherwise it would leak the wrong condition into their resolution.This is a generic fix to honor
bun/denoexport conditions; it is not tied to any single dependency.