MCPcopy
hub / github.com/vitejs/vite / createToImportMetaURLBasedRelativeRuntime

Function createToImportMetaURLBasedRelativeRuntime

packages/vite/src/node/build.ts:1667–1678  ·  view source on GitHub ↗
(
  format: InternalModuleFormat,
  isWorker: boolean,
)

Source from the content-addressed store, hash-verified

1665}
1666
1667export function createToImportMetaURLBasedRelativeRuntime(
1668 format: InternalModuleFormat,
1669 isWorker: boolean,
1670): (filename: string, importer: string) => { runtime: string } {
1671 const formatLong = isWorker && format === 'iife' ? 'worker-iife' : format
1672 const toRelativePath = customRelativeUrlMechanisms[formatLong]
1673 return (filename, importer) => ({
1674 runtime: toRelativePath(
1675 path.posix.relative(path.dirname(importer), filename),
1676 ),
1677 })
1678}
1679
1680export function toOutputFilePathWithoutRuntime(
1681 filename: string,

Callers 4

renderAssetUrlInJSFunction · 0.90
handlerFunction · 0.90
renderChunkFunction · 0.90
renderChunkFunction · 0.90

Calls 1

toRelativePathFunction · 0.85

Tested by

no test coverage detected