Skip to content

Commit

Permalink
Avoid filename conflict
Browse files Browse the repository at this point in the history
We need to make sure that `.json` and `.json.js` doesn't end up with the same name. So make sure to always add an extension.
  • Loading branch information
sokra committed Feb 7, 2023
1 parent 9c4d81b commit 4d04bb0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/turbopack-core/src/chunk/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ impl ChunkingContext for DevChunkingContext {
let truncated_hash = &hash[..5];
name = format!("{}_{}", truncated_hash, &name[i..]);
}
if !name.ends_with(extension) {
name += extension;
}
// We need to make sure that `.json` and `.json.js` doesn't end up with the same
// name. So make sure to always add an extension.
name += "._";
name += extension;
let mut root_path = self.chunk_root_path;
#[allow(clippy::single_match, reason = "future extensions")]
match extension {
Expand Down

0 comments on commit 4d04bb0

Please sign in to comment.