Automatically reloading WASM on changes? #4442
-
|
I've managed to rewrite my entire web application in Leptos and couldn't be happier! It's much simpler to use than the previous, non-reactive web framework. I've run into an issue though related to releasing new versions of the app. When I reload the app with the browsers that I'm using, Firefox and Chrome, the latest version of the WASM isn't downloaded unless I do a hard refresh (Shift+Reload). This is obviously due to caching, not wanting to redownload the WASM again when it likely hasn't changed. I wonder if anyone here has modified their application such that the new WASM will be downloaded only when it changes? My guess is that this isn't necessarily all a Leptos-specific question, but may require some tweaks to how Leptos is deployed? Perhaps a change to how the WASM is linked in the top-level HTML? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Which build tool are you using? If you are using trunk, it automatically hashes the WASM file name so that when you deploy a changed version, it will load the new one and not cache it. If you are using |
Beta Was this translation helpful? Give feedback.
-
|
Just wanted to give a heads up that I took your advice here and was able to get things up and running, though it took some trial and error as there are some adjustments that I needed to make an order for it to work with the Lambda deployment I'm doing. I'll put together a PR for some documentation changes to cover this, but will be looking for feedback from those more in the know to make sure there's a reasonable boundary between general details and stuff specific to deploying via Lambda (though I'll add some stuff to that section too). All that to say, I'm closing this out as I've gotten my answer. Thanks again for your help, as usual. |
Beta Was this translation helpful? Give feedback.
Which build tool are you using? If you are using trunk, it automatically hashes the WASM file name so that when you deploy a changed version, it will load the new one and not cache it. If you are using
cargo-leptos, you can enable file hashing withhash-files = true(note that you'll probably then want to swap fromStylesheettoHashedStylesheetor it will not load the correct CSS)