cardano-serialization-lib
cardano-serialization-lib copied to clipboard
WebAssembly.instantiateStreaming
Hi, I'm trying to use the browser module however I'm having issues using the WebAssembly.instantiateStreaming method. The framework I'm using doesn't support wasm via the 'import' method and they've said the only way is to use WebAssembly.instantiate / Streaming.
const importObject = {
module: {}
};
const fetchPromise = fetch('/wasm/cardano_serialization_lib_bg.wasm');
const wasmInstance = await WebAssembly.instantiateStreaming(fetchPromise, importObject);
this._wasm = wasmInstance.exports;
I can fetch the file correctly however WebAssembly.instantiateStreaming throws the below error message.
TypeError: WebAssembly.instantiate(): Import #0 module="./cardano_serialization_lib_bg.js" error: module is not an object or function
Does anyone have any ideas on how I can get wasm on a browser to work with the above method? I've tried using raw JS / asm but unsurprisingly it's incredibly slow (55+ seconds to add up change), so WebAssembly.instantiateStreaming remains my only option.
Thanks!