You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#1330 and potentially even prior implementations breaks the way go WASM execution is handled.
The fix for this would be to return the promise for WebAssembly.instantiateStreaming(fetch(response, opts); in packages/vite/src/node/plugins/wasm.ts on lines 17, 33, and 37.
Destructuring
expecting the returned value of WebAssembly.instantiateStreaming(fetch('src/main.wasm'), go.importObject);
and using wasm_exec.js provided by golang
import'./wasm_exec.js';//required for golang
...
constgo=newwindow.Go();constinitWasm=async()=>{const{ instance, module }=awaitmain(go.importObject);console.log(instance,module);awaitgo.run(instance);}
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Provide a description in this issue that describes the bug.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
Describe the bug
#1330 and potentially even prior implementations breaks the way go WASM execution is handled.
The fix for this would be to return the promise for
WebAssembly.instantiateStreaming(fetch(response, opts);
in packages/vite/src/node/plugins/wasm.ts on lines 17, 33, and 37.Destructuring
expecting the returned value of
WebAssembly.instantiateStreaming(fetch('src/main.wasm'), go.importObject);
and using
wasm_exec.js
provided by golangproduces this error:
running directly:
produces this error:
using go.run (provided by wasm_exec.js) on the returned object:
produces this error:
The only way to do this at the moment is to create a ternary based on the current build mode, then use a fetch to the URL.
Reproduction
https://github.com/AskAlice/moshpit.wasm/tree/master/web
System Info
Output of
npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:Used package manager: NPM
Logs
Before submitting the issue, please make sure you do the following
The text was updated successfully, but these errors were encountered: