Skip to content

Commit

Permalink
Merge 9238771 into bf0980e
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Feb 7, 2023
2 parents bf0980e + 9238771 commit 0b8ddaf
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 25 deletions.
11 changes: 8 additions & 3 deletions crates/turbopack-core/src/chunk/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ impl ChunkingContext for DevChunkingContext {
} else {
clean(&path_vc.to_string().await?)
};
if name.ends_with(extension) {
let removed_extension = name.ends_with(extension);
if removed_extension {
name.truncate(name.len() - extension.len());
}

Expand All @@ -148,9 +149,13 @@ 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 when we add an extra extension when want to mark that with a "._"
// suffix.
if !removed_extension {
name += "._";
}
name += extension;
let mut root_path = self.chunk_root_path;
#[allow(clippy::single_match, reason = "future extensions")]
match extension {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0b8ddaf

Please sign in to comment.