Skip to content

re: Sharing Classes between Rust and JavaScript VIEW POST


Thanks for the tutorial :)
However, for the second example you missed the two steps with the building process - cargo build ..... and wasm-bindgen ........
(Also - on wasm-bindgen command it complained with my package.json I copied form previous example. So I created a new package.json with only "dependencies" in it, ran the wasm-bindgen command and after that I copied the actual package.json from the previous example. That's how it worked.)
But what was most frustrating to me was that I got errors when I tried to compile - it didn't want to load the point.js file. It started working for me when I modified it like this:
#[wasm_bindgen(module = "/point.js")]
Absolute path & adding extension.
(Probably it's because of the wasm-bindgen version - 0.2.58 on my machine.
... I don't know.)
Anyway, thanks for the tutorial once again ... it's very useful ;)


Yeah I think there is a bug in the wasm-bindgen. Currently this should be manually amended in the generated JS file.


same here:
relative module paths aren't supported yet
this worked:

#[wasm_bindgen(module = "point.js")]

code of conduct - report abuse