Open jsoneaday opened 5 months ago
I just tried switching to this module code, but same error.
#[wasmedge_bindgen]
pub fn init() {
let mut ctx = Context::new();
let code = r#"
let module = import("main.js")
module
"#;
let p = ctx.eval_global_str(code);
ctx.promise_loop_poll();
if let JsValue::Promise(ref p) = p {
let module = p.get_result();
println!("v: {:?}", module);
if let JsValue::Object(obj_mod) = module {
let func = obj_mod.get("init");
println!("init func: {:?}", func);
if let JsValue::Function(func) = func {
let result = func.call(&mut []);
println!("result {:?}", result);
}
}
}
}
The js module is a large bundled file, but the main function that I'm trying to call looks like this
import Arweave from "arweave";
export { default as Arweave } from "arweave";
export { default as WarpArBundles } from "warp-arbundles";
export function init() {
return Arweave.init({});
}
Your use case seems to be running WebAssembly in a browser and then using JavaScript within the WebAssembly. This scenario is not supported by us; our goal is to run JavaScript within WASI.
I get this error when calling a function called init from a rust host. I've tried including the js file both in the wasm file and the in the host project but continue to get this error. My entire project can be found at https://github.com/jsoneaday/ao in the servers/cu_rs folder
This is the wasm module
// this is the host function calling the init function in the module