diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 00f7e3cc73108f..dfcb70c89c93a1 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -989,7 +989,7 @@ function loadPreprocessor(lang: PreprocessLang, root: string): any { try { // Search for the preprocessor in the root directory first, and fall back // to the default require paths. - const fallbackPaths = require.resolve.paths(lang) || [] + const fallbackPaths = require.resolve.paths?.(lang) || [] const resolved = require.resolve(lang, { paths: [root, ...fallbackPaths] }) return (loadedPreprocessors[lang] = require(resolved)) } catch (e) {