Skip to content

Commit

Permalink
fix(css): loadPreprocessor tolerate require.resolve.paths not exists (
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 6, 2021
1 parent 1f068fc commit c588b8f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/css.ts
Expand Up @@ -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) {
Expand Down

0 comments on commit c588b8f

Please sign in to comment.