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