Home / Function/ tryResolveRealFileOrType() — vite Function Reference

tryResolveRealFileOrType() — vite Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  04eba3ee_b103_fb12_64a9_27459b1e87c1["tryResolveRealFileOrType()"]
  dcff87b0_a8ea_57a2_3b29_a7b8f19986f3["resolve.ts"]
  04eba3ee_b103_fb12_64a9_27459b1e87c1 -->|defined in| dcff87b0_a8ea_57a2_3b29_a7b8f19986f3
  8ac17738_0641_9534_aa4e_c559f410561a["tryCleanFsResolve()"]
  8ac17738_0641_9534_aa4e_c559f410561a -->|calls| 04eba3ee_b103_fb12_64a9_27459b1e87c1
  a9bd45ce_8339_2b77_7543_41c306ebdb02["tryStatSync()"]
  04eba3ee_b103_fb12_64a9_27459b1e87c1 -->|calls| a9bd45ce_8339_2b77_7543_41c306ebdb02
  5d4527d1_7d40_0edb_838d_808ad61dc38e["getRealPath()"]
  04eba3ee_b103_fb12_64a9_27459b1e87c1 -->|calls| 5d4527d1_7d40_0edb_838d_808ad61dc38e
  66405bb2_893b_16d8_47a4_76b06e9ca1bc["isDirectory()"]
  04eba3ee_b103_fb12_64a9_27459b1e87c1 -->|calls| 66405bb2_893b_16d8_47a4_76b06e9ca1bc
  style 04eba3ee_b103_fb12_64a9_27459b1e87c1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/resolve.ts lines 1207–1219

function tryResolveRealFileOrType(
  file: string,
  preserveSymlinks?: boolean,
): { path?: string; type: 'directory' | 'file' } | undefined {
  const fileStat = tryStatSync(file)
  if (fileStat?.isFile()) {
    return { path: getRealPath(file, preserveSymlinks), type: 'file' }
  }
  if (fileStat?.isDirectory()) {
    return { type: 'directory' }
  }
  return
}

Domain

Subdomains

Frequently Asked Questions

What does tryResolveRealFileOrType() do?
tryResolveRealFileOrType() is a function in the vite codebase, defined in packages/vite/src/node/plugins/resolve.ts.
Where is tryResolveRealFileOrType() defined?
tryResolveRealFileOrType() is defined in packages/vite/src/node/plugins/resolve.ts at line 1207.
What does tryResolveRealFileOrType() call?
tryResolveRealFileOrType() calls 3 function(s): getRealPath, isDirectory, tryStatSync.
What calls tryResolveRealFileOrType()?
tryResolveRealFileOrType() is called by 1 function(s): tryCleanFsResolve.

Analyze Your Own Codebase

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

Try Supermodel Free