fix(resolver): fix a case where package name and specifier is the wrong order

This commit is contained in:
Boshen 2023-08-10 16:54:04 +08:00
parent 66c9d764d1
commit caf1dfbfcd

View file

@ -565,7 +565,7 @@ impl<Fs: FileSystem> ResolverGeneric<Fs> {
);
}
// 4. If the SCOPE/package.json "name" is not the first segment of X, return.
let Some(subpath) = package_json.name.as_ref().and_then(|package_json_name| package_json_name.strip_prefix(specifier)) else {
let Some(subpath) = package_json.name.as_ref().and_then(|package_json_name| specifier.strip_prefix(package_json_name)) else {
return Ok(None);
};
// 5. let MATCH = PACKAGE_EXPORTS_RESOLVE(pathToFileURL(SCOPE),