When I compiled the file, I got two kinds of error messages like this:
1.TypeError: WebAssembly.instantiate(): Import #0 "wasi_snapshot_preview1": module is not an object or function
2.TypeError: WebAssembly.instantiate(): Imports argument must be present and must be an object
Is there a way to generate a wasm file that works fine directly in the browser. I just need to run it in the browser.
https://github.com/bjorn3/browser_wasi_shim . I've looked at this method as well, but it doesn't seem to work in pure HTML.
Also, using Javy to compile JavaScript to Wasm can greatly improve performance?
When I compiled the file, I got two kinds of error messages like this:
1.TypeError: WebAssembly.instantiate(): Import #0 "wasi_snapshot_preview1": module is not an object or function 2.TypeError: WebAssembly.instantiate(): Imports argument must be present and must be an object
Is there a way to generate a wasm file that works fine directly in the browser. I just need to run it in the browser.
The functions in the index.js are:
function run() { console.log(123) }
run();
The way to load the module is:
fetch('add.wasm') .then(response => response.arrayBuffer()) .then(bytes => WebAssembly.instantiate(bytes)) .then(result => { result.instance.exports.run(); });
https://github.com/bjorn3/browser_wasi_shim . I've looked at this method as well, but it doesn't seem to work in pure HTML. Also, using Javy to compile JavaScript to Wasm can greatly improve performance?