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
  de7c238b_5de0_b239_8e00_2ac0473f2a86["hmrShouldReload()"]
  6ab27e01_6eaf_ac42_26b1_65aa8211cc0d["parse()"]
  6ab27e01_6eaf_ac42_26b1_65aa8211cc0d -->|calls| de7c238b_5de0_b239_8e00_2ac0473f2a86
  ed5fe71b_2eb2_ab85_8bbb_eb87a7fa5e82["isImportUsed()"]
  de7c238b_5de0_b239_8e00_2ac0473f2a86 -->|calls| ed5fe71b_2eb2_ab85_8bbb_eb87a7fa5e82
  style de7c238b_5de0_b239_8e00_2ac0473f2a86 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