mirror of
https://github.com/swc-project/swc.git
synced 2024-10-04 12:18:08 +03:00
fix(es/module): Fix regression of resolving relative modules (#8748)
**Description:** - x-ref (vercel slack): https://vercel.slack.com/archives/C03S8ED1DKM/p1710371667695459?thread_ts=1710362018.271789&cid=C03S8ED1DKM **Related issue (if exists):**
This commit is contained in:
parent
31ecd2a6c1
commit
f988b66e1f
@ -419,7 +419,7 @@ impl NodeModulesResolver {
|
||||
module_specifier, base, self.target_env
|
||||
);
|
||||
|
||||
{
|
||||
if !module_specifier.starts_with('.') {
|
||||
// Handle absolute path
|
||||
|
||||
let path = Path::new(module_specifier);
|
||||
|
@ -319,11 +319,13 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
let path = self.base_url.join(module_specifier);
|
||||
if !module_specifier.starts_with('.') {
|
||||
let path = self.base_url.join(module_specifier);
|
||||
|
||||
// https://www.typescriptlang.org/docs/handbook/modules/reference.html#baseurl
|
||||
if let Ok(v) = self.invoke_inner_resolver(base, &path.to_string_lossy()) {
|
||||
return Ok(v);
|
||||
// https://www.typescriptlang.org/docs/handbook/modules/reference.html#baseurl
|
||||
if let Ok(v) = self.invoke_inner_resolver(base, &path.to_string_lossy()) {
|
||||
return Ok(v);
|
||||
}
|
||||
}
|
||||
|
||||
self.invoke_inner_resolver(base, module_specifier)
|
||||
|
@ -2,7 +2,7 @@ use std::{
|
||||
borrow::Cow,
|
||||
env::current_dir,
|
||||
fs::read_link,
|
||||
io,
|
||||
io::{self},
|
||||
path::{Component, Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user