comlink-loader icon indicating copy to clipboard operation
comlink-loader copied to clipboard

Using WASM modules in Comlink-ed Webworker

Open sklinov opened this issue 3 years ago • 2 comments

For my project I have a WASM (Rust based) module imported as a package using wasm-pack. In the regular (non-Web Worker) workflow the package works just fine, but when I put everything under comlink-loader things start to break and I get

_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.add_two_ints is not a function

initially coming from

callback
src/comlink.ts:312
  309 |   break;
  310 | case MessageType.APPLY:
  311 |   {
> 312 |     returnValue = rawValue.apply(parent, argumentList);
      | ^  313 |   }
  314 |   break;
  315 | case MessageType.CONSTRUCT:

is there a good way to keep comlink-loader and fix that?

sklinov avatar Jan 03 '22 08:01 sklinov

I'm running into the same problem, @sklinov did you find any workaround for this?

outkine avatar Jun 24 '22 15:06 outkine

@outkine Sorry to write that here, but I've migrated from comlink-loader to another tool. You can check out my boilerplate example here https://github.com/sklinov/react-wasm

sklinov avatar Jun 24 '22 16:06 sklinov