Skip to content

Commit

Permalink
Only allow for .../*.js specifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Jul 15, 2024
1 parent 1a8f574 commit 904e2f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/turbopack-core/src/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1925,8 +1925,10 @@ async fn resolve_relative_request(
// TODO path_pattern might not be a constant?
// TODO extension might be empty, or dots in filepath
if let Pattern::Constant(s) = path_pattern {
if let Some((base, _ext)) = s.rsplit_once(".") {
new_path = Pattern::Alternatives(vec![Pattern::Constant(base.into()), new_path])
if let Some((base, ext)) = s.rsplit_once(".") {
if ext == "js" {
new_path = Pattern::Alternatives(vec![Pattern::Constant(base.into()), new_path])
}
}
} else {
todo!("enable_js_ts_rewriting");
Expand Down

0 comments on commit 904e2f8

Please sign in to comment.