Home / Function/ findNearestPackagePath() — vite Function Reference

findNearestPackagePath() — vite Function Reference

Architecture documentation for the findNearestPackagePath() function in resolve.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  0b337126_5c19_f205_45cd_5ce740e74c86["findNearestPackagePath()"]
  dcff87b0_a8ea_57a2_3b29_a7b8f19986f3["resolve.ts"]
  0b337126_5c19_f205_45cd_5ce740e74c86 -->|defined in| dcff87b0_a8ea_57a2_3b29_a7b8f19986f3
  310b19b4_2716_b45b_716d_edfca3064152["tryNodeResolve()"]
  310b19b4_2716_b45b_716d_edfca3064152 -->|calls| 0b337126_5c19_f205_45cd_5ce740e74c86
  31b651d6_9d57_14b0_2e8c_d85642bc19f4["findNearestPackageData()"]
  0b337126_5c19_f205_45cd_5ce740e74c86 -->|calls| 31b651d6_9d57_14b0_2e8c_d85642bc19f4
  style 0b337126_5c19_f205_45cd_5ce740e74c86 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/resolve.ts lines 1233–1242

function findNearestPackagePath(
  file: string,
  legacyInconsistentCjsInterop: boolean | undefined,
  packageCache: PackageCache | undefined,
  isBuild: boolean,
) {
  if (!isBuild || legacyInconsistentCjsInterop) return
  const pkgData = findNearestPackageData(file, packageCache)
  return pkgData ? path.join(pkgData.dir, 'package.json') : null
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does findNearestPackagePath() do?
findNearestPackagePath() is a function in the vite codebase, defined in packages/vite/src/node/plugins/resolve.ts.
Where is findNearestPackagePath() defined?
findNearestPackagePath() is defined in packages/vite/src/node/plugins/resolve.ts at line 1233.
What does findNearestPackagePath() call?
findNearestPackagePath() calls 1 function(s): findNearestPackageData.
What calls findNearestPackagePath()?
findNearestPackagePath() is called by 1 function(s): tryNodeResolve.

Analyze Your Own Codebase

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

Try Supermodel Free