How to reset all built js chunks hashes and purge clients' cache? #7976
-
I had some situation when there was an internal error on express side and it returned some broken response.
So, the client got this broken response cached on their end. How can I achieve this? It seems like hash changes only if file was actually modified, so I have to modify all the files in order to do that, which doesn't look right. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Sounds painful. Quick fix would be to change the build output path from the default Pretty worrying to think something as widely used as express static would have a bug that could cause this. To mitigate any future risk, you should prob consider pushing your |
Beta Was this translation helpful? Give feedback.
-
Instead of relying on file modification time for cache-busting, consider using versioned file names. This means changing the file names themselves whenever you make changes. For example, you can include a version or a timestamp in the file name, such as In your deployment process, you can automate the renaming of files or include a build step that generates versioned file names. |
Beta Was this translation helpful? Give feedback.
Sounds painful. Quick fix would be to change the build output path from the default
public/build
to something else in your remix config, e.g.public/buildv2
-- https://remix.run/docs/en/main/file-conventions/remix-config#assetsbuilddirectory.Pretty worrying to think something as widely used as express static would have a bug that could cause this. To mitigate any future risk, you should prob consider pushing your
public
directory to a CDN / static hosting.