Skip to content

Commit 9dbdf8d

Browse files
committed
fix: preserve extension if the import is a package
1 parent a3e816b commit 9dbdf8d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/plugin.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ pub struct Config {
1111
}
1212

1313
fn replace_ts_extension(src: &ast::Str, config: &Config) -> Option<ast::Str> {
14-
if src.value.ends_with(".ts") && !src.value.ends_with(".d.ts") {
14+
if !src.value.starts_with('.') {
15+
return None;
16+
} else if src.value.ends_with(".ts") && !src.value.ends_with(".d.ts") {
1517
if let Some(file) = src.value.strip_suffix(".ts") {
1618
return Some(format!("{}.js", file).into());
1719
}

0 commit comments

Comments
 (0)