perf(resolver): do not search for package.json inside non-existing directories (#1480)

This commit is contained in:
Boshen 2023-11-21 16:57:44 +08:00 committed by GitHub
parent 51a78e2223
commit 7b909de28e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -247,6 +247,13 @@ impl CachedPathImpl {
if let Some(cv) = &cache_value.parent {
cache_value = cv.as_ref();
}
} else {
// Go up a directory when the querying path is neither a file nor a directory
if !cache_value.is_dir(fs) {
if let Some(cv) = &cache_value.parent {
cache_value = cv.as_ref();
}
}
}
let mut cache_value = Some(cache_value);
while let Some(cv) = cache_value {