Home / Function/ stripBase() — vite Function Reference

stripBase() — vite Function Reference

Architecture documentation for the stripBase() function in utils.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  013086ce_01e9_45cb_743f_587baeb03e55["stripBase()"]
  031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"]
  013086ce_01e9_45cb_743f_587baeb03e55 -->|defined in| 031bc221_67a8_c579_f2bf_bb30a08beeb2
  a1fc1de5_905b_efe7_d960_3597604fbdfe["importAnalysisPlugin()"]
  a1fc1de5_905b_efe7_d960_3597604fbdfe -->|calls| 013086ce_01e9_45cb_743f_587baeb03e55
  8e6cd7a2_b085_0a8f_7999_c4deeeb6ef5e["baseMiddleware()"]
  8e6cd7a2_b085_0a8f_7999_c4deeeb6ef5e -->|calls| 013086ce_01e9_45cb_743f_587baeb03e55
  29f999b6_18cf_5f75_7b27_cf12b0774ee0["preTransformRequest()"]
  29f999b6_18cf_5f75_7b27_cf12b0774ee0 -->|calls| 013086ce_01e9_45cb_743f_587baeb03e55
  478016d8_bc28_f869_6d7e_76982bf2825d["handleModuleSoftInvalidation()"]
  478016d8_bc28_f869_6d7e_76982bf2825d -->|calls| 013086ce_01e9_45cb_743f_587baeb03e55
  1a3bec7b_1a11_316f_5831_a0535b829bbf["withTrailingSlash()"]
  013086ce_01e9_45cb_743f_587baeb03e55 -->|calls| 1a3bec7b_1a11_316f_5831_a0535b829bbf
  style 013086ce_01e9_45cb_743f_587baeb03e55 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/utils.ts lines 1538–1544

export function stripBase(path: string, base: string): string {
  if (path === base) {
    return '/'
  }
  const devBase = withTrailingSlash(base)
  return path.startsWith(devBase) ? path.slice(devBase.length - 1) : path
}

Domain

Subdomains

Frequently Asked Questions

What does stripBase() do?
stripBase() is a function in the vite codebase, defined in packages/vite/src/node/utils.ts.
Where is stripBase() defined?
stripBase() is defined in packages/vite/src/node/utils.ts at line 1538.
What does stripBase() call?
stripBase() calls 1 function(s): withTrailingSlash.
What calls stripBase()?
stripBase() is called by 4 function(s): baseMiddleware, handleModuleSoftInvalidation, importAnalysisPlugin, preTransformRequest.

Analyze Your Own Codebase

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

Try Supermodel Free