Home / Function/ createToImportMetaURLBasedRelativeRuntime() — vite Function Reference

createToImportMetaURLBasedRelativeRuntime() — vite Function Reference

Architecture documentation for the createToImportMetaURLBasedRelativeRuntime() function in build.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  c25246ea_7a11_06af_dc93_7717f85216db["createToImportMetaURLBasedRelativeRuntime()"]
  45981d85_cbdd_e969_8c88_c17072ea0eda["build.ts"]
  c25246ea_7a11_06af_dc93_7717f85216db -->|defined in| 45981d85_cbdd_e969_8c88_c17072ea0eda
  edf78a01_8215_eb46_3896_3db717c46747["renderAssetUrlInJS()"]
  edf78a01_8215_eb46_3896_3db717c46747 -->|calls| c25246ea_7a11_06af_dc93_7717f85216db
  cd131d16_e223_ab79_1b7c_8ea449ae51a2["cssPostPlugin()"]
  cd131d16_e223_ab79_1b7c_8ea449ae51a2 -->|calls| c25246ea_7a11_06af_dc93_7717f85216db
  488c94be_f327_5956_a885_8d97686ca66e["wasmHelperPlugin()"]
  488c94be_f327_5956_a885_8d97686ca66e -->|calls| c25246ea_7a11_06af_dc93_7717f85216db
  1a156a4f_5015_f60f_3a54_6eb2168861ca["webWorkerPlugin()"]
  1a156a4f_5015_f60f_3a54_6eb2168861ca -->|calls| c25246ea_7a11_06af_dc93_7717f85216db
  6d8b0c42_77dd_1f09_c23b_25bba559c5df["toRelativePath()"]
  c25246ea_7a11_06af_dc93_7717f85216db -->|calls| 6d8b0c42_77dd_1f09_c23b_25bba559c5df
  style c25246ea_7a11_06af_dc93_7717f85216db fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/build.ts lines 1630–1641

export function createToImportMetaURLBasedRelativeRuntime(
  format: InternalModuleFormat,
  isWorker: boolean,
): (filename: string, importer: string) => { runtime: string } {
  const formatLong = isWorker && format === 'iife' ? 'worker-iife' : format
  const toRelativePath = customRelativeUrlMechanisms[formatLong]
  return (filename, importer) => ({
    runtime: toRelativePath(
      path.posix.relative(path.dirname(importer), filename),
    ),
  })
}

Domain

Subdomains

Frequently Asked Questions

What does createToImportMetaURLBasedRelativeRuntime() do?
createToImportMetaURLBasedRelativeRuntime() is a function in the vite codebase, defined in packages/vite/src/node/build.ts.
Where is createToImportMetaURLBasedRelativeRuntime() defined?
createToImportMetaURLBasedRelativeRuntime() is defined in packages/vite/src/node/build.ts at line 1630.
What does createToImportMetaURLBasedRelativeRuntime() call?
createToImportMetaURLBasedRelativeRuntime() calls 1 function(s): toRelativePath.
What calls createToImportMetaURLBasedRelativeRuntime()?
createToImportMetaURLBasedRelativeRuntime() is called by 4 function(s): cssPostPlugin, renderAssetUrlInJS, wasmHelperPlugin, webWorkerPlugin.

Analyze Your Own Codebase

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

Try Supermodel Free