fix: use sync dns.getDefaultResultOrder instead of dns.promises#22185
Merged
bluwy merged 1 commit intovitejs:mainfrom Apr 7, 2026
Merged
Conversation
`getDefaultResultOrder` is a synchronous function that exists on the
`dns` module but not on `dns.promises` in Bun. The current code imports
`{ promises as dns }` and calls `dns.getDefaultResultOrder()`, which
resolves to `dns.promises.getDefaultResultOrder()` at runtime — a method
Bun does not implement.
Import `getDefaultResultOrder` directly from `node:dns` (the sync
namespace) so the early-return guard works on both Node.js and Bun.
Fixes vitejs#22184
bluwy
approved these changes
Apr 7, 2026
|
Well this is still not working on deno, but I guess this is a deno issue: denoland/deno#33195 |
|
deno --version deno task build |
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.
Summary
Fixes #22184
getLocalhostAddressIfDiffersFromDNS(introduced in #22151, commit 56ec256) callsdns.getDefaultResultOrder()— butdnsis aliased fromnode:dns'spromisesnamespace (import { promises as dns }), so it resolves todns.promises.getDefaultResultOrder()at runtime.Bun does not implement
dns.promises.getDefaultResultOrder(tested on 1.3.10, 1.3.11 stable, 1.3.12 canary), causingvite buildto fail since 8.0.6:getDefaultResultOrderis synchronous by nature — this PR imports it directly fromnode:dns(the sync/callback namespace) instead of going throughdns.promises.Change
getDefaultResultOrderfromnode:dnsalongside the existingpromisesimportgetDefaultResultOrder()directly instead ofdns.getDefaultResultOrder()Test plan
vite buildunder Bun 1.3.x no longer throwsdns.getDefaultResultOrderexists on bothdnsanddns.promisesin Node