Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to code have no effect after first compilation #283

Open
erikbrntsn opened this issue Nov 23, 2022 · 5 comments
Open

Changes to code have no effect after first compilation #283

erikbrntsn opened this issue Nov 23, 2022 · 5 comments

Comments

@erikbrntsn
Copy link

Changes to code in the exercise of section 4.2 and later have no effect.

Only the result of the first compilation is ever used. Any changes after compiling the first time have no effect.
I have tried changing the version in the cargo.toml (as described in #261) + restarted the server + uninstall wasm-game-of-life from www and readded in to the dependencies section + removed the www app and recreated it. None of these steps help :(

The only way I have found to get around the problem is to remove the entire wasm-game-of-life folder and recreating it + applying all the changes to the code before running wasm-pack build.

Note this is the case for the steps in the subsection "Implementing Life" as well and not only in the exercise of section 4.2.

To Reproduce
Follow every steps in the tutorial.

Expected behavior
All changes to code are reflected in the behavior of the web app.

Additional context
I am following the steps in the tutorial and I am pretty sure I have done everything exactly as described. The first changes to the code after first compilation are made in the exercise in 4.2. This I where the problem occurs the first time.

@erikbrntsn
Copy link
Author

erikbrntsn commented Nov 23, 2022

I have found a simpler workaround.

After you have made your changes to your code and run wasm-pack build do the following:

Steps:
remove "wasm-game-of-life": "../pkg" from the dependecies section of package.json
run npm install
re-add "wasm-game-of-life": "../pkg" to the dependencies
run npm install
stop the server
run npm run start (possibly like this: NODE_OPTIONS=--openssl-legacy-provider npm run start)

I am pretty new to basically all the involved components of this (JS, npm, rust, wasm) so it is very likely there is a better way to accomplish the same in a simpler way. Please let me know

@grampajoe
Copy link

grampajoe commented Nov 24, 2022

I'm having the same issue. It looks like the files in pkg/ are copied into www/npm_modules/wasm-game-of-life/ instead of getting symlinked, and they don't get updated when wasm-pack build or npm install are re-run after editing src/lib.rs.

@grampajoe
Copy link

grampajoe commented Nov 24, 2022

Downgrading to [email protected] fixes this: npm install -g [email protected].

It could be a behavior change in 9.1? Possibly related: npm/cli#5868

This is an intentional change in 9.0 (release notes):

install-links config defaults to "true"

The cleanest solution is probably to use npm link ../pkg from www/. The tutorial will need to be updated to reflect the change in npm behavior.

@geekynils
Copy link

I have the same problem after following just the very first part (Hello World) and running nom link ../pkg does not seem to have an effect.

@CLEckhardt
Copy link

The cleanest solution is probably to use npm link ../pkg from www/. The tutorial will need to be updated to reflect the change in npm behavior.

Thank you!! I kept running into:

WARNING in ./index.js 4:17-25
"export 'Universe' was not found in 'wasm-game-of-life'
 @ ./bootstrap.js

and this fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants