Home / Function/ loadPreprocessorPath() — vite Function Reference

loadPreprocessorPath() — vite Function Reference

Architecture documentation for the loadPreprocessorPath() function in css.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  ee6b4ebe_4e17_548c_a8a5_aafc4db9c675["loadPreprocessorPath()"]
  c3eb47df_971b_0616_6c9f_29b3ded72224["css.ts"]
  ee6b4ebe_4e17_548c_a8a5_aafc4db9c675 -->|defined in| c3eb47df_971b_0616_6c9f_29b3ded72224
  a4066f3a_4f19_8edd_3fb6_20980be68a48["loadSassPackage()"]
  a4066f3a_4f19_8edd_3fb6_20980be68a48 -->|calls| ee6b4ebe_4e17_548c_a8a5_aafc4db9c675
  751b79e8_9d2f_8cb9_88a2_dc2d6f7ccc09["loadSss()"]
  751b79e8_9d2f_8cb9_88a2_dc2d6f7ccc09 -->|calls| ee6b4ebe_4e17_548c_a8a5_aafc4db9c675
  b115d8d2_4bdd_4a69_c76d_1789ff11d443["lessProcessor()"]
  b115d8d2_4bdd_4a69_c76d_1789ff11d443 -->|calls| ee6b4ebe_4e17_548c_a8a5_aafc4db9c675
  158d0e42_28ce_8bd3_13df_1f08b6dbf23f["stylProcessor()"]
  158d0e42_28ce_8bd3_13df_1f08b6dbf23f -->|calls| ee6b4ebe_4e17_548c_a8a5_aafc4db9c675
  363641b4_de9b_dbe1_f421_1fd46e488386["nodeResolveWithVite()"]
  ee6b4ebe_4e17_548c_a8a5_aafc4db9c675 -->|calls| 363641b4_de9b_dbe1_f421_1fd46e488386
  394db340_6e2e_70b3_4235_398eb2dcb74c["getPackageManagerCommand()"]
  ee6b4ebe_4e17_548c_a8a5_aafc4db9c675 -->|calls| 394db340_6e2e_70b3_4235_398eb2dcb74c
  style ee6b4ebe_4e17_548c_a8a5_aafc4db9c675 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/css.ts lines 2405–2425

function loadPreprocessorPath(
  lang: PreprocessLang | PostCssDialectLang | 'sass-embedded',
  root: string,
): string {
  const cached = loadedPreprocessorPath[lang]
  if (cached) {
    return cached
  }

  // Try resolve from project root first, then the current vite installation path
  const resolved =
    nodeResolveWithVite(lang, undefined, { root }) ??
    nodeResolveWithVite(lang, _dirname, { root })
  if (resolved) return (loadedPreprocessorPath[lang] = resolved)

  // Error if we can't find the preprocessor
  const installCommand = getPackageManagerCommand('install')
  throw new Error(
    `Preprocessor dependency "${lang}" not found. Did you install it? Try \`${installCommand} -D ${lang}\`.`,
  )
}

Domain

Subdomains

Frequently Asked Questions

What does loadPreprocessorPath() do?
loadPreprocessorPath() is a function in the vite codebase, defined in packages/vite/src/node/plugins/css.ts.
Where is loadPreprocessorPath() defined?
loadPreprocessorPath() is defined in packages/vite/src/node/plugins/css.ts at line 2405.
What does loadPreprocessorPath() call?
loadPreprocessorPath() calls 2 function(s): getPackageManagerCommand, nodeResolveWithVite.
What calls loadPreprocessorPath()?
loadPreprocessorPath() is called by 4 function(s): lessProcessor, loadSassPackage, loadSss, stylProcessor.

Analyze Your Own Codebase

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

Try Supermodel Free