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

Function load

packages/vite/src/node/plugins/css.ts:1588–1604  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

1586 return id
1587 },
1588 async load(id) {
1589 const code = await fs.promises.readFile(id, 'utf-8')
1590 const lang = CSS_LANGS_RE.exec(id)?.[1] as CssLang | undefined
1591 if (isPreProcessor(lang)) {
1592 const result = await compileCSSPreprocessors(
1593 environment,
1594 id,
1595 lang,
1596 code,
1597 workerController,
1598 )
1599 result.deps?.forEach((dep) => deps.add(dep))
1600 // TODO: support source map
1601 return result.code
1602 }
1603 return code
1604 },
1605 nameLayer(index) {
1606 return `vite--anon-layer-${getHash(id)}-${index}`
1607 },

Callers

nothing calls this directly

Calls 4

isPreProcessorFunction · 0.85
compileCSSPreprocessorsFunction · 0.85
rebaseUrlsFunction · 0.85
addMethod · 0.80

Tested by

no test coverage detected