fix: wasm loading

This commit is contained in:
Derrick Hammer 2023-06-24 03:33:35 -04:00
parent 1c738c8aae
commit a530a07f01
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 4 deletions

View File

@ -5,12 +5,12 @@ export default async function (imports) {
// @ts-ignore
const wasmPath = new URL("wasm/bao.wasm", import.meta.url);
const wasm = await fs.readFile(wasmPath);
return WebAssembly.instantiate(wasm, imports);
return (await WebAssembly.instantiate(wasm, imports)).instance;
}
// @ts-ignore
return await import("./wasm/bao.wasm");
let wasm = await import("./wasm/bao.wasm");
wasm = wasm.default || wasm;
return (await wasm(imports)).instance;
}