-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebAssembly.Compile
is disallowed on the main thread, if the buffer size is larger than 4KB.
#74
Comments
Can you provide detailed repro steps? |
I think this is a browser error... but that file is not used in browsers.
Either:
|
It is an Electron app that uses the lib, it might be the bundler. I will have a more in detail look. Thank you for the hint. |
Facing the same issue. I ended up creating a fork and updating the browser loader. // Suppress TS2792: Cannot find module './secp256k1.wasm'.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import wasm from "./secp256k1.wasm";
import * as rand from "./rand.js";
import * as validate_error from "./validate_error.js";
const imports = {
"./rand.js": rand,
"./validate_error.js": validate_error,
};
const mod = await WebAssembly.compile(Buffer.from(wasm.split(',')[1], 'base64'));
const instance = await WebAssembly.instantiate(mod, imports);
export default instance.exports; |
hey @motorina0 , |
Currently the
WebAssembly
part is loaded synchronously:This results in the following error:
WebAssembly.Compile
is disallowed on the main thread, if the buffer size is larger than 4KB. UseWebAssembly.compile
, or compile on a worker thread.However the
async
version of the methods cannot be run on the top-level file AFAIK.Any ideas how to fix this?
The text was updated successfully, but these errors were encountered: