Skip to content

Commit

Permalink
perf: don't do remapping if there's only one sourcemap (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
underfin committed Mar 29, 2024
1 parent ca51a6b commit aee9f39
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/rolldown_sourcemap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ pub fn collapse_sourcemaps(
mut sourcemap_chain: Vec<&SourceMap>,
) -> Result<Option<SourceMap>, BuildError> {
let Some(last_map) = sourcemap_chain.pop() else { return Ok(None) };
// If there is only one sourcemap, return it as result.
if sourcemap_chain.is_empty() {
return Ok(Some(last_map.clone()));
}

let mut sourcemap_builder = SourceMapBuilder::new(None);

Expand Down

0 comments on commit aee9f39

Please sign in to comment.