2025-01-03
I have been trying to run wasm code built with wasm-pack with pythonmonkey, a Mozilla SpiderMonkey JavaScript engine embedded into the Python Runtime.
Consider a lib.rs as follow:
use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn add(a: i32, b: i32) -> i32 { return a + b; } With wasm-pack, we can build the src code to wasm
wasm-pack build --target nodejs --no-typescript We will get a .wasm file and a .js wrapper file.
Continue reading