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

Function toAssetPathFromHtml

packages/plugin-legacy/src/index.ts:103–119  ·  view source on GitHub ↗
(
  filename: string,
  htmlPath: string,
  config: ResolvedConfig,
)

Source from the content-addressed store, hash-verified

101}
102
103function toAssetPathFromHtml(
104 filename: string,
105 htmlPath: string,
106 config: ResolvedConfig,
107): string {
108 const relativeUrlPath = normalizePath(path.relative(config.root, htmlPath))
109 const toRelative = (filename: string, _hostId: string) =>
110 getBaseInHTML(relativeUrlPath, config) + filename
111 return toOutputFilePathInHtml(
112 filename,
113 'asset',
114 htmlPath,
115 'html',
116 config,
117 toRelative,
118 )
119}
120
121const legacyEnvVarMarker = `__VITE_IS_LEGACY__`
122const modernEnvVarMarker = `__VITE_IS_MODERN__`

Callers 1

transformIndexHtmlFunction · 0.85

Calls 2

normalizePathFunction · 0.90
toOutputFilePathInHtmlFunction · 0.85

Tested by

no test coverage detected