This error seems to be blocking any updates. I am loosing my mind trying to force the ‘old’ page 1.4.3 to go to ‘new’ 2.1.5. You probably never see the 1.4.3 because it’s your first time, but I cannot get rid of it. I tried http redirects to domain.com?v=2 but even those did not kick in. How can I force the ‘OLD’ code to give up loading from cache and go get the newest content? Not a PWA expert, Thanks
Usually, the browser checks for service worker updates automatically, that is any changes made to the service-worker.js file. When it finds a change, it loads the new one and starts using it on the next page load. On your machine you can always refresh everything using the Dev Tools in your browser.
Try making sure you update your service worker with the updated assets and then deploy it again.
Hope to be helpful!
Try adding “npm version patch” in your package.json.
Example:
“scripts”: {
“build”: “npm version patch & cross-env NODE_ENV=production vite build”,
},
Somewhere in your application (i use in logout button):
if (‘serviceWorker’ in navigator) {
navigator.serviceWorker
.getRegistrations()
.then(function (registrations) {
for (let registration of registrations) {
registration.unregister()
}
})
}