Home / Function/ getLocalhostAddressIfDiffersFromDNS() — vite Function Reference

getLocalhostAddressIfDiffersFromDNS() — vite Function Reference

Architecture documentation for the getLocalhostAddressIfDiffersFromDNS() function in utils.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  13a82d8a_e10d_9354_366c_f04ea0cda579["getLocalhostAddressIfDiffersFromDNS()"]
  031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"]
  13a82d8a_e10d_9354_366c_f04ea0cda579 -->|defined in| 031bc221_67a8_c579_f2bf_bb30a08beeb2
  369388dc_006d_6dcb_70b4_e174e2ad592f["resolveHostname()"]
  369388dc_006d_6dcb_70b4_e174e2ad592f -->|calls| 13a82d8a_e10d_9354_366c_f04ea0cda579
  style 13a82d8a_e10d_9354_366c_f04ea0cda579 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/utils.ts lines 923–934

export async function getLocalhostAddressIfDiffersFromDNS(): Promise<
  string | undefined
> {
  const [nodeResult, dnsResult] = await Promise.all([
    dns.lookup('localhost'),
    dns.lookup('localhost', { verbatim: true }),
  ])
  const isSame =
    nodeResult.family === dnsResult.family &&
    nodeResult.address === dnsResult.address
  return isSame ? undefined : nodeResult.address
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getLocalhostAddressIfDiffersFromDNS() do?
getLocalhostAddressIfDiffersFromDNS() is a function in the vite codebase, defined in packages/vite/src/node/utils.ts.
Where is getLocalhostAddressIfDiffersFromDNS() defined?
getLocalhostAddressIfDiffersFromDNS() is defined in packages/vite/src/node/utils.ts at line 923.
What calls getLocalhostAddressIfDiffersFromDNS()?
getLocalhostAddressIfDiffersFromDNS() is called by 1 function(s): resolveHostname.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free