Home / Function/ toRelativePath() — vite Function Reference

toRelativePath() — vite Function Reference

Architecture documentation for the toRelativePath() function in importAnalysisBuild.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  6d8b0c42_77dd_1f09_c23b_25bba559c5df["toRelativePath()"]
  04ad4685_2ce3_556a_152b_c93668a74b3b["importAnalysisBuild.ts"]
  6d8b0c42_77dd_1f09_c23b_25bba559c5df -->|defined in| 04ad4685_2ce3_556a_152b_c93668a74b3b
  c25246ea_7a11_06af_dc93_7717f85216db["createToImportMetaURLBasedRelativeRuntime()"]
  c25246ea_7a11_06af_dc93_7717f85216db -->|calls| 6d8b0c42_77dd_1f09_c23b_25bba559c5df
  6d315957_5b5c_845c_10c4_b8cb46bc58eb["buildImportAnalysisPlugin()"]
  6d315957_5b5c_845c_10c4_b8cb46bc58eb -->|calls| 6d8b0c42_77dd_1f09_c23b_25bba559c5df
  style 6d8b0c42_77dd_1f09_c23b_25bba559c5df fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/importAnalysisBuild.ts lines 36–39

function toRelativePath(filename: string, importer: string) {
  const relPath = path.posix.relative(path.posix.dirname(importer), filename)
  return relPath[0] === '.' ? relPath : `./${relPath}`
}

Domain

Subdomains

Frequently Asked Questions

What does toRelativePath() do?
toRelativePath() is a function in the vite codebase, defined in packages/vite/src/node/plugins/importAnalysisBuild.ts.
Where is toRelativePath() defined?
toRelativePath() is defined in packages/vite/src/node/plugins/importAnalysisBuild.ts at line 36.
What calls toRelativePath()?
toRelativePath() is called by 2 function(s): buildImportAnalysisPlugin, createToImportMetaURLBasedRelativeRuntime.

Analyze Your Own Codebase

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

Try Supermodel Free