book
book copied to clipboard
"Getting Started" step missing?
Where in the docs did you come across this?
Exercises at the end of section 4.2 "Hello, World!"
Describe what about it does not make sense
After making the suggested changes to src/lib.rs
and www/index.js
, running wasm-pack build
, and refreshing the browser, I still see "Hello, hello-wasm-pack" and not the expected greeting. I tried deleting the target
directory, running wasm-pack build
again, and re-rerunning npm run build
and npm run start
, but I can't get my changes to have any effect. Is there a missing step?
Why does it not make sense?
I can't get the expected result.
How could we improve it?
Supply the missing step(s) if there are any.
@mvolkmann , You may have missed one of the steps in this section. You likely need to:
- Update the package.json with a dependency pointing to the local wasm package built in
../pkg
. - Update the index.js file to import that package.
I missed the second step on my own first run through and it took me a while to realize the module I was importing in index.js
was some module from npm and not the local package.
I've run into the same issue. The problem was that npm install
did not reinstall wasm-game-of-life package.
Solution: Delete node_modules
directory, then run npm install
.
Alternatively you can run npm ci
, which does the same thing.