-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
Description
WebAssembly modules are able to import foreign Javascript functions and memory objects that are passed in the second parameter of WebAssembly.instantiate(...). Unfortunately the current WASM loader is hard-coded to call instantiate with no import object.
https://github.com/parcel-bundler/parcel/blob/master/src/builtins/loaders/wasm-loader.js
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate
The simplest solution would be to have the WASM loader instead run WebAssembly.compile(...) and return the compiled WebAssembly.Module, so the user can call WebAssembly.instantiate(...) with whatever parameters they need. I think that's how Webpacks wasm loader works.
Reactions are currently unavailable