Skip to content

Commit c588b8f

Browse files
authored
fix(css): loadPreprocessor tolerate require.resolve.paths not exists (#4853)
1 parent 1f068fc commit c588b8f

File tree

1 file changed

+1
-1
lines changed
  • packages/vite/src/node/plugins

1 file changed

+1
-1
lines changed

packages/vite/src/node/plugins/css.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ function loadPreprocessor(lang: PreprocessLang, root: string): any {
989989
try {
990990
// Search for the preprocessor in the root directory first, and fall back
991991
// to the default require paths.
992-
const fallbackPaths = require.resolve.paths(lang) || []
992+
const fallbackPaths = require.resolve.paths?.(lang) || []
993993
const resolved = require.resolve(lang, { paths: [root, ...fallbackPaths] })
994994
return (loadedPreprocessors[lang] = require(resolved))
995995
} catch (e) {

0 commit comments

Comments
 (0)