( lang: PreprocessLang | PostCssDialectLang | 'sass-embedded', root: string, )
| 2424 | > = {} |
| 2425 | |
| 2426 | function loadPreprocessorPath( |
| 2427 | lang: PreprocessLang | PostCssDialectLang | 'sass-embedded', |
| 2428 | root: string, |
| 2429 | ): string { |
| 2430 | const cached = loadedPreprocessorPath[lang] |
| 2431 | if (cached) { |
| 2432 | return cached |
| 2433 | } |
| 2434 | |
| 2435 | // Try resolve from project root first, then the current vite installation path |
| 2436 | const resolved = |
| 2437 | nodeResolveWithVite(lang, undefined, { root }) ?? |
| 2438 | nodeResolveWithVite(lang, _dirname, { root }) |
| 2439 | if (resolved) return (loadedPreprocessorPath[lang] = resolved) |
| 2440 | |
| 2441 | // Error if we can't find the preprocessor |
| 2442 | const installCommand = getPackageManagerCommand('install') |
| 2443 | throw new Error( |
| 2444 | `Preprocessor dependency "${lang}" not found. Did you install it? Try \`${installCommand} -D ${lang}\`.`, |
| 2445 | ) |
| 2446 | } |
| 2447 | |
| 2448 | function loadSassPackage( |
| 2449 | root: string, |
no test coverage detected