Closed inzanez closed 11 months ago
@inzanez If you only want to use the wasm in a web worker, you should create and use the module in the web worker.
Passing data from the main thread to a worker thread has restrictions due to transferable objects and the structured clone algorithm. You can read more about transferable objects and structured clone to figure out why it not gona work.
@Priestch I see. Yeah, I just never managed to create the wasm module in the worker because the standard 'js' file is not a module, and therefore I would need to use importScripts
which does not exist in a module worker.
So I had to manually patch the emscripten generated 'js' file.
@inzanez You can try to use some bundler tool to bundle the wasm js file to the worker js file, then you hopefully can use the worker like before.
@Priestch Yes, that seems to work out! Thanks
Hi
did anyone succeed passing that WASM module into a web worker? I tried different techniques so far, but up until now always failed.