Skip to content

Commit

Permalink
fix: export all symbols for Wasm modules (#977)
Browse files Browse the repository at this point in the history
Closes #974
  • Loading branch information
bartlomieju authored Nov 21, 2024
1 parent 06a310e commit a5bfca9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/modules/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2067,9 +2067,7 @@ fn render_js_wasm_module(specifier: &str, wasm_deps: WasmDeps) -> String {
}

if !wasm_deps.exports.is_empty() {
for export_desc in wasm_deps.exports.iter().filter(|e| {
matches!(e.export_type, wasm_dep_analyzer::ExportType::Function(_))
}) {
for export_desc in wasm_deps.exports.iter() {
if export_desc.name == "default" {
src.push(format!(
"export default modInstance.exports.{};",
Expand Down Expand Up @@ -2198,6 +2196,11 @@ const importsObject = {
};
const modInstance = new import.meta.WasmInstance(wasmMod, importsObject);
export const export1 = modInstance.exports.export1;
export const export2 = modInstance.exports.export2;
export const export3 = modInstance.exports.export3;
export const export4 = modInstance.exports.export4;
export const export5 = modInstance.exports.export5;
export const export6 = modInstance.exports.export6;
export default modInstance.exports.default;"#,
);
}

0 comments on commit a5bfca9

Please sign in to comment.