Home / Function/ getHmrImplementation() — vite Function Reference

getHmrImplementation() — vite Function Reference

Architecture documentation for the getHmrImplementation() function in clientInjections.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  b2ef9799_cd96_ba83_06a5_28e8fa51363d["getHmrImplementation()"]
  706c7fc5_ca45_d178_75a9_66940b856450["clientInjections.ts"]
  b2ef9799_cd96_ba83_06a5_28e8fa51363d -->|defined in| 706c7fc5_ca45_d178_75a9_66940b856450
  e6c19722_5c65_17df_83d9_4bb453d26d5b["getRolldownOptions()"]
  e6c19722_5c65_17df_83d9_4bb453d26d5b -->|calls| b2ef9799_cd96_ba83_06a5_28e8fa51363d
  95af623a_b371_82bb_94fc_ff6a88f1555c["generateFallbackHtml()"]
  95af623a_b371_82bb_94fc_ff6a88f1555c -->|calls| b2ef9799_cd96_ba83_06a5_28e8fa51363d
  3928ac07_6613_c9d3_38dd_625918721277["createClientConfigValueReplacer()"]
  b2ef9799_cd96_ba83_06a5_28e8fa51363d -->|calls| 3928ac07_6613_c9d3_38dd_625918721277
  style b2ef9799_cd96_ba83_06a5_28e8fa51363d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/clientInjections.ts lines 136–146

export async function getHmrImplementation(
  config: ResolvedConfig,
): Promise<string> {
  const content = fs.readFileSync(normalizedClientEntry, 'utf-8')
  const replacer = await createClientConfigValueReplacer(config)
  return (
    replacer(content)
      // the rolldown runtime cannot import a module
      .replace(/import\s*['"]@vite\/env['"]/, '')
  )
}

Domain

Subdomains

Frequently Asked Questions

What does getHmrImplementation() do?
getHmrImplementation() is a function in the vite codebase, defined in packages/vite/src/node/plugins/clientInjections.ts.
Where is getHmrImplementation() defined?
getHmrImplementation() is defined in packages/vite/src/node/plugins/clientInjections.ts at line 136.
What does getHmrImplementation() call?
getHmrImplementation() calls 1 function(s): createClientConfigValueReplacer.
What calls getHmrImplementation()?
getHmrImplementation() is called by 2 function(s): generateFallbackHtml, getRolldownOptions.

Analyze Your Own Codebase

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

Try Supermodel Free