yew-pwa-minimal
yew-pwa-minimal copied to clipboard
Fix caching in the service worker
After switching to trunk
, the filenames of the wasm module and the generated js file contain a hash and will change on every update.
Currently, the service_worker.js
file contains a list of filenames to cache, which doesn't work anymore due to the hash being part of the filename.
Possible solutions:
- Tell
trunk
to generate stable filenames without hashes - Generate / modify
service_worker.js
during build such that it contains the correct filenames
I don't know much about web dev and caching in particular, so it's not clear to me which option is preferable. I'll leave this issue open for now, but feel free to make suggestions on the topic.
I don't have enough time to open a PR but for everyone looking for fix - you can add
[build]
filehash = false
to Trunk.toml
to tell trunk
to generate stable filenames
#6 implements @damszew's solution.
Is this all we need to do? Does this have any impact on cache invalidation? Do we have a strategy in that space?