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

Function handler

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

Source from the content-addressed store, hash-verified

340 id: CSS_LANGS_RE,
341 },
342 handler(id) {
343 if (urlRE.test(id)) {
344 if (isModuleCSSRequest(id)) {
345 throw new Error(
346 `?url is not supported with CSS modules. (tried to import ${JSON.stringify(
347 id,
348 )})`,
349 )
350 }
351
352 // *.css?url
353 // in dev, it's handled by assets plugin.
354 if (isBuild) {
355 id = injectQuery(removeUrlQuery(id), 'transform-only')
356 return (
357 `import ${JSON.stringify(id)};` +
358 `export default "__VITE_CSS_URL__${Buffer.from(id).toString(
359 'hex',
360 )}__"`
361 )
362 }
363 }
364 },
365 },
366 transform: {
367 filter: {

Callers 1

listenerFunction · 0.50

Calls 15

injectQueryFunction · 0.90
removeUrlQueryFunction · 0.90
stripBomTagFunction · 0.90
getHashFunction · 0.90
cleanUrlFunction · 0.90
isModuleCSSRequestFunction · 0.85
compileCSSFunction · 0.85
isDirectCSSRequestFunction · 0.85
getContentWithSourcemapFunction · 0.85
minifyCSSFunction · 0.85
addMethod · 0.80

Tested by 1

listenerFunction · 0.40