Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Wasm - Cannot find module env #72

Closed
fredfortier opened this issue Jun 17, 2021 · 2 comments
Closed

Wasm - Cannot find module env #72

fredfortier opened this issue Jun 17, 2021 · 2 comments

Comments

@fredfortier
Copy link

This crate is triggering the behavior documented here: rust-bitcoin/rust-secp256k1#254, here: rustwasm/wasm-bindgen#2160 and here: rustwasm/wasm-pack#743

Please let me know if you think the root cause is similar and can patch quickly.

@fredfortier
Copy link
Author

I tried manually replacing require('env') with require('crypto'), which I assume is what it wants.

let imports = {};
imports['__wbindgen_placeholder__'] = module.exports;
imports['env'] = require('crypto');

It does not work, but it might offer an additional clue:

$ node ./build/index.js
/src/rust-packages/ddx-wasm/examples/node_modules/ddx-wasm/ddx_wasm.js:173
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
                     ^

LinkError: WebAssembly.Instance(): Import #1 module="env" function="GFp_aes_nohw_encrypt" error: function import requires a callable

@MatthewHerbst
Copy link

@fredfortier did you end up solving this issue? I'm running into something very similar but can't seem to figure out why it's including the env import. Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants