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

webpack does not rebuild after rust source files are changed more than twice. #180

Open
chmnchiang opened this issue Jan 2, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@chmnchiang
Copy link

Describe the Bug

Running yarn start should start a dev-server that will recompile webpack bundle every time the rust source file is changed, but it fails to do so after a few changes.

Steps to Reproduce

  1. In any directory, run npm init rust-webpack my-app to clone the template.
  2. cd my-app and then npm start to start the dev server.
  3. Edit src/lib.rs, for example, duplicate the line console::log_1(...). The browser will reload and we could see Hello world! get print twice in the console.
  4. Edit src/lib.rs, for example, duplicate the line console::log_1(...) again.
  5. See below.

If applicable, add a link to a test case (as a zip file or link to a repository we can clone).

Expected Behavior

The wasm file get recompiled, the bundle is rebuilt and the browser reloads.

Actual Behavior

The wasm file get recompiled, however, the bundle is never rebuild and the browser does not reload. Manually reload the browser does not solve the issue because the bundle isn't rebuilt.

@pkelleter
Copy link

@chmnchiang

This seems to be an issue with webpack or webpack-dev-server itself. The wasm file is built with a hash for long-term caching and this hash seems not to update more than once. I had the exact same issue with the game-of-life tutorial and tried to fix it for several hours until i gave up. After seeing that the same issue seems to exist on this repository i got suspicous and changed the versions in webpack from ^ to exact syntax, so instead of ^4.42.0 i went 4.42.0 and so on with all dependencies. That fixes it. So it seems some allegedly "minor" patch broke this in one of the dependencies. And it is still buggy in Webpack 5 even, as it seems, since i tried to fix by migrating to 5 and it didn't work.

If someone has the time to dig deeper and find out what exact dependency causes this and create an issue in the repo of the corresponding library (probably webpack itself) i would be more than glad. Unfortunately I will not find that time in the next weeks myself.

@SonyStone
Copy link

If someone has the time to dig deeper and find out what exact dependency causes this and create an issue in the repo of the corresponding library (probably webpack itself) i would be more than glad. Unfortunately I will not find that time in the next weeks myself.

wasm-tool/wasm-pack-plugin#125 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants