-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
.wasm files are too aggressively cached by the server #1376
Comments
For a slightly more self-contained reprodution:
|
Just ran into this too. If someone can point me to the relevant module(s) for webpack I can take a look. |
I think this is an issue in webpack itself rather than Steps to reproduce without using dev server:
|
@glenjamin Nice catch. |
I don't know how works the caching strategy in Webpack. Maybe it can not compare binary files? |
add test case to verify that webpack/webpack-dev-server#1376 is fixed
This is fixed in the "next" branch in webpack/webpack. We are working on upgrading the WASM pipeline and will merge this to master in a few days. |
Awesome, thanks so much @sokra! |
@xtuc whether the other issue fixes (which we were discussing) landed in |
I can confirm this is now fixed on Webpack 4.8 Nice! |
Looks like we can close issue! Please upgrade to |
Code
Test case: https://github.com/rustwasm/wasm_game_of_life/tree/d1d20e6b8ffe9f63e8a058055d5696ede0a41927
Expected Behavior
Modifying the
.wasm
triggers a refresh of the page with the new.wasm
modifications reflected, just like modifying JS files does.Actual Behavior
The
.wasm
seems to be too aggressively cached bywebpack-dev-server
, and changes to it are not reflected on the page unless the server is restarted.(Note: I verified that disabling the network cache in the browser results in fresh 200 requests for the
.wasm
but that the response payload is not the modified.wasm
on disk, ergo this bug is not the browser's network cache acting up.)For Bugs; How can we reproduce the behavior?
Install the rust toolchain so you can modify and recompile the
.wasm
, as described in https://rust-lang-nursery.github.io/rust-wasm/game-of-life/setup.htmlcd wasm_game_of_life
npm install
npm run serve
in a new terminal, so it will keep runningverify that the game of life is working at http://localhost:8080
In
src/lib.rs
, find thepub fn new() -> Universe
method. Replace its body withpanic!()
:npm run build-debug
to rebuild the.wasm
with the panic changesrefresh http://localhost:8080 -- it should not have a working game of life anymore, and there should be an error in the console from the panic. If it is still working, then that means the new
.wasm
was not loaded.The text was updated successfully, but these errors were encountered: