Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/mako/src/plugins/wasm_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl Plugin for WasmRuntimePlugin {
));

wasm_import_object_code.push_str(&format!(
"\"{module}\": {{ {names} }}",
"\"{module}\": {{ {names} }},",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change correctly fixes a bug where invalid JavaScript was generated for WASM modules with multiple imports. While adding a trailing comma works and is valid in modern JavaScript, a more idiomatic and robust approach in Rust is to build a list of strings and then use join(", "). This avoids manual comma management and the resulting trailing comma, leading to cleaner and more maintainable code.

module = key,
names = value
.iter()
Expand Down
Loading