I've been banging my head against this brick wall for 2 days now and I cannot figure it out. I'm trying to load my wasm module in a web worker in a Vue app and nothing I can find works. First, let me explain what does work. I can load my wasm module in the main thread (async) and then use it without any problems at all. However, as soon as I try to load it in a web worker it breaks. I set up a repo here so you can see the code:
https://github.com/mthelm85/wasm-web-worker
The error in the console is:
wasm.worker.worker.js:1 Uncaught (in promise) TypeError: WebAssembly.instantiate(): Import #0 module="./permutations_bg.js" error: module is not an object or function
I'm building the module with wasm-pack
and using the default target (bundler).
I assumed this was just a webpack issue but I've tried many different options (using @wasm-tool/wasm-pack-plugin
, adding an experiments: { syncWebAssembly: true }
to my webpack config, etc.) and none of them do the trick.
I would be extremely grateful to anyone who can assist in any way with figuring this out