Home / Function/ urlToBuiltUrl() — vite Function Reference

urlToBuiltUrl() — vite Function Reference

Architecture documentation for the urlToBuiltUrl() function in asset.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  70054416_c841_dc8b_5bd9_4793198b4325["urlToBuiltUrl()"]
  e71b94ef_3010_e358_13d8_f3b3acb0a268["asset.ts"]
  70054416_c841_dc8b_5bd9_4793198b4325 -->|defined in| e71b94ef_3010_e358_13d8_f3b3acb0a268
  39f26be8_b1d9_a756_3043_474687a6bbb7["buildHtmlPlugin()"]
  39f26be8_b1d9_a756_3043_474687a6bbb7 -->|calls| 70054416_c841_dc8b_5bd9_4793198b4325
  b1f5b07b_f692_69cd_1795_627055928bb7["getTopLevelConfig()"]
  70054416_c841_dc8b_5bd9_4793198b4325 -->|calls| b1f5b07b_f692_69cd_1795_627055928bb7
  be351481_35b7_f392_a229_ac14e1fa7efb["checkPublicFile()"]
  70054416_c841_dc8b_5bd9_4793198b4325 -->|calls| be351481_35b7_f392_a229_ac14e1fa7efb
  0d5e9fd7_88bb_e8eb_37e0_dee52752ef34["publicFileToBuiltUrl()"]
  70054416_c841_dc8b_5bd9_4793198b4325 -->|calls| 0d5e9fd7_88bb_e8eb_37e0_dee52752ef34
  a4adb1a7_cf54_091f_eb63_8217e684a8e1["normalizePath()"]
  70054416_c841_dc8b_5bd9_4793198b4325 -->|calls| a4adb1a7_cf54_091f_eb63_8217e684a8e1
  86195de2_9c12_1f7e_7a3e_0754a5695ebe["fileToBuiltUrl()"]
  70054416_c841_dc8b_5bd9_4793198b4325 -->|calls| 86195de2_9c12_1f7e_7a3e_0754a5695ebe
  style 70054416_c841_dc8b_5bd9_4793198b4325 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/asset.ts lines 511–533

export async function urlToBuiltUrl(
  pluginContext: PluginContext,
  url: string,
  importer: string,
  forceInline?: boolean,
): Promise<string> {
  const topLevelConfig = pluginContext.environment.getTopLevelConfig()
  if (checkPublicFile(url, topLevelConfig)) {
    return publicFileToBuiltUrl(url, topLevelConfig)
  }
  const file = normalizePath(
    url[0] === '/'
      ? path.join(topLevelConfig.root, url)
      : path.join(path.dirname(importer), url),
  )
  return fileToBuiltUrl(
    pluginContext,
    file,
    // skip public check since we just did it above
    true,
    forceInline,
  )
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does urlToBuiltUrl() do?
urlToBuiltUrl() is a function in the vite codebase, defined in packages/vite/src/node/plugins/asset.ts.
Where is urlToBuiltUrl() defined?
urlToBuiltUrl() is defined in packages/vite/src/node/plugins/asset.ts at line 511.
What does urlToBuiltUrl() call?
urlToBuiltUrl() calls 5 function(s): checkPublicFile, fileToBuiltUrl, getTopLevelConfig, normalizePath, publicFileToBuiltUrl.
What calls urlToBuiltUrl()?
urlToBuiltUrl() is called by 1 function(s): buildHtmlPlugin.

Analyze Your Own Codebase

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

Try Supermodel Free