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

Fix caching in the service worker #3

Open
fkohlgrueber opened this issue Jul 11, 2022 · 2 comments
Open

Fix caching in the service worker #3

fkohlgrueber opened this issue Jul 11, 2022 · 2 comments

Comments

@fkohlgrueber
Copy link
Owner

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.

@damszew
Copy link

damszew commented Nov 25, 2022

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

@0awful
Copy link

0awful commented Jan 11, 2023

#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?

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

3 participants