Home / Function/ hmrShouldReload() — vue Function Reference

hmrShouldReload() — vue Function Reference

Architecture documentation for the hmrShouldReload() function in compileScript.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  b31e5b26_32b1_8a91_cb54_b4b50934e2ba["hmrShouldReload()"]
  9bec4c5e_d04b_64a6_018b_53a3e409ef44["parse()"]
  9bec4c5e_d04b_64a6_018b_53a3e409ef44 -->|calls| b31e5b26_32b1_8a91_cb54_b4b50934e2ba
  da2f5c14_8623_685a_a52f_77d53de34be4["isImportUsed()"]
  b31e5b26_32b1_8a91_cb54_b4b50934e2ba -->|calls| da2f5c14_8623_685a_a52f_77d53de34be4
  style b31e5b26_32b1_8a91_cb54_b4b50934e2ba fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/compiler-sfc/src/compileScript.ts lines 1896–1916

export function hmrShouldReload(
  prevImports: Record<string, ImportBinding>,
  next: SFCDescriptor
): boolean {
  if (!next.scriptSetup) {
    return false
  }

  const isTS = next.scriptSetup.lang === 'ts' || next.scriptSetup.lang === 'tsx'
  // for each previous import, check if its used status remain the same based on
  // the next descriptor's template
  for (const key in prevImports) {
    // if an import was previous unused, but now is used, we need to force
    // reload so that the script now includes that import.
    if (!prevImports[key].isUsedInTemplate && isImportUsed(key, next, isTS)) {
      return true
    }
  }

  return false
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does hmrShouldReload() do?
hmrShouldReload() is a function in the vue codebase.
What does hmrShouldReload() call?
hmrShouldReload() calls 1 function(s): isImportUsed.
What calls hmrShouldReload()?
hmrShouldReload() is called by 1 function(s): parse.

Analyze Your Own Codebase

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

Try Supermodel Free