Skip to content

Commit

Permalink
fix: source_map_buffer error handle
Browse files Browse the repository at this point in the history
  • Loading branch information
SyMind committed Aug 30, 2024
1 parent 6034a23 commit 38d8268
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,14 @@ impl SourceMapDevToolPlugin {
asset.to_writer(&mut buffer).into_diagnostic()?;
buffer
};
let source_map_buffer = source_map.map(|source_map| {
let mut buffer = Vec::new();
source_map
.to_writer(&mut buffer)
.unwrap_or_else(|e| panic!("{}", e.to_string()));
buffer
});
let source_map_buffer = match source_map {
Some(map) => {
let mut buffer = Vec::new();
map.to_writer(&mut buffer).into_diagnostic()?;
Some(buffer)
}
None => None,
};

let mut asset = compilation
.assets()
Expand Down

0 comments on commit 38d8268

Please sign in to comment.