Skip to content

Commit

Permalink
fix(resolve): use different importer check for css imports (#12815)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Apr 10, 2023
1 parent ad358da commit d037327
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/vite/src/node/plugins/resolve.ts
Expand Up @@ -695,11 +695,13 @@ export function tryNodeResolve(
let basedir: string
if (dedupe?.includes(pkgId)) {
basedir = root
} else if (importer && path.isAbsolute(importer)) {
} else if (
importer &&
path.isAbsolute(importer) &&
// css processing appends `*` for importer
(importer[importer.length - 1] === '*' || fs.existsSync(cleanUrl(importer)))
) {
basedir = path.dirname(importer)
if (!fs.existsSync(basedir)) {
basedir = root
}
} else {
basedir = root
}
Expand Down

0 comments on commit d037327

Please sign in to comment.