Skip to content

Raw bindings get undefined "exports" var #2921

Open
@calibertechnology

Description

@calibertechnology

Bug description

Expected exports to contain wasm exports, instead getting undefined value.

Steps to reproduce

Run asc with --bindings raw. In build/release.js line 24 now contains:

const { exports } = await WebAssembly.instantiate(module, adaptedImports);

I think this should instead be

const { instance } = await WebAssembly.instantiate(module, adaptedImports);
const { exports } = instance.exports;

I haven't done a PR before, so I'll describe the proposed change:

In src/bindings/js.ts line 646:

replace sb.push("const { exports } = await WebAssembly.instantiate(module");
with sb.push("const { instance } = await WebAssembly.instantiate(module");

then at line 652 insert:

indent(sb, this.indentLevel);
sb.push("const { exports } = instance.exports;\n");

AssemblyScript version

v0.27.36

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions