Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed May 8, 2024
1 parent 5161997 commit 549bbdb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/swc_ecma_transforms_module/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ where
false
};

let file_stem_matches = if let Some(stem) = target_path.file_stem() {
stem == orig_filename
} else {
false
};

if self.config.resolve_fully && is_resolved_as_js {
} else if orig_filename == "index" {
// Import: `./foo/index`
Expand All @@ -188,6 +194,8 @@ where
// Resolved: `./foo/index.js`

target_path.pop();
} else if is_resolved_as_non_js && self.config.resolve_fully && file_stem_matches {
target_path.set_extension("js");
} else if !is_resolved_as_js && !is_resolved_as_index && !is_exact {
target_path.set_file_name(orig_filename);
} else if is_resolved_as_non_js && is_exact {
Expand Down

0 comments on commit 549bbdb

Please sign in to comment.