Service Worker not busting cache.
See original GitHub issueHello, I’ve got a weird issue.
In devtools, I have cache disabled.
When I hit ctrl+r
, it still lads a cached old file with an error.
When I hit shift+ctrl+r
, no problem, and the new file is used and error is gone.
Despite Chrome devtools having cache disabled, that has no effect. Only pressing shift+ctrl+r
loads the non-cached version, while pressing ctrl+r
always loads the older cached file.
Seems like this has to do with service worker. How do I ensure that caching works properly with the service worker, to eliminate that as possible source of the problem?
Note, I’ve loaded the production build with a static server a couple times to test it, not sure if that’s somehow messing up with the service worker while I’m in dev
mode.
I’m experiencing this in dev
mode.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:21
@xerosanyam here is a crude way: Create a single javascript file that you exclude from cache and then check for that file say every 10seconds from within your app somewhere. Once the file is not found (due to the suffix of it changing, you can force reload the entire page using
window.location.reload(true)
That is because it currently gets generated on every build. You need to update the
vue.config.js
file as I mentioned above, withThis tells the pwa plugin that you supply your own service-worker.