Content-Length: 223518 | pFad | http://github.com/AssemblyScript/assemblyscript/issues/2921

B5 Raw bindings get undefined "exports" var · Issue #2921 · AssemblyScript/assemblyscript · GitHub
Skip to content

Raw bindings get undefined "exports" var #2921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
calibertechnology opened this issue May 20, 2025 · 1 comment
Open

Raw bindings get undefined "exports" var #2921

calibertechnology opened this issue May 20, 2025 · 1 comment
Labels

Comments

@calibertechnology
Copy link

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

@CountBleck
Copy link
Member

It should work if you pass in a WebAssembly.Module instance instead of an ArrayBuffer. Confusingly, WebAssembly.instantiate has two different return types, depending on the type of the argument.

@CountBleck CountBleck added question and removed bug labels May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/AssemblyScript/assemblyscript/issues/2921

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy