fix: wasm loading
This commit is contained in:
parent
1c738c8aae
commit
a530a07f01
|
@ -5,12 +5,12 @@ export default async function (imports) {
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const wasmPath = new URL("wasm/bao.wasm", import.meta.url);
|
const wasmPath = new URL("wasm/bao.wasm", import.meta.url);
|
||||||
|
|
||||||
const wasm = await fs.readFile(wasmPath);
|
const wasm = await fs.readFile(wasmPath);
|
||||||
|
return (await WebAssembly.instantiate(wasm, imports)).instance;
|
||||||
return WebAssembly.instantiate(wasm, imports);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return await import("./wasm/bao.wasm");
|
let wasm = await import("./wasm/bao.wasm");
|
||||||
|
wasm = wasm.default || wasm;
|
||||||
|
return (await wasm(imports)).instance;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue