Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
h-a-n-a committed Aug 23, 2024
1 parent b6c45f7 commit a202878
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ pub(crate) async fn resolve_loader(
description_data,
..
} = resource;
// Pitfall: `PathBuf::ends_with` is different from `str::ends_with`
// Pitfall: `Path::ends_with` is different from `str::ends_with`
// So we need to convert `PathBuf` to `&str`
// Use `str::ends_with` instead of `PathBuf::extension` to avoid unnecessary allocation
// Use `str::ends_with` instead of `Path::extension` to avoid unnecessary allocation
let path = path.as_str();

let r#type = if path.ends_with(".mjs") {
Expand Down

0 comments on commit a202878

Please sign in to comment.