Open b4ux1t3 opened 3 years ago
Doing some reading and troubleshooting, I was able to produce a slightly different error when explicitly targeting the web in my call to wasm-pack
. (wasm-pack build --target=web
)
In this case, the wasm_game_of_life.js
file gets substantially more content, but it appears that the wasm
variable it tries to use never gets declared, leading to the following error:
This doesn't really clear up the original issue, and doesn't lead to a fix or workaround as far as I can tell.
Describe the bug With updated tooling (read: no vulnerabilities in
npm audit
),wasm-pack
produces non-runnable code when following the directions in the book for the hello world program (and as such, for the rest of the book).To Reproduce Steps to reproduce the behavior:
localhost:8080
.Expected behavior Application should display
Hello, wasm-game-of-life!
in an alert box.Screenshots
Additional context The code generated by
wasm-pack
exports all members of the JavaScript file./wasm_game_of_life_bg.js
after importing all members of the file./wasm_game_of_life_bg.wasm
, but this doesn't appear to work.I'm unsure at this time if the issue is with
wasm-pack
itself, or just a missing step in the book.The basic functionality works when I directly export the greet function like so in
wasm_game_of_life.js
:This mirrors what the book says should have been generated to begin with.
However, I do not get the ability to pass strings to the function.
wasm-pack version 0.9.1 rustc version 1.48.0