-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
selfDestroying doesn't destroy the service worker #30
Comments
I had this same issue. I was able to solve it by removing the site from my history (in my case it was just localhost -- http://127.0.0.1:3000/). There should be something like "remove this site from my history" in the History settings of your browser. |
@matthew-dean @Zavim have you read the docs? You MUST not change anything in the configuration, just add |
I hadn't changed anything in the configuration, just removed localhost:3000 from my browser history. Either way, my case was a practice PWA, not client-facing. |
I have the same issue and I didn't change anything in the config. |
I think of adding a script to GTM to unregister a service worker, bust the cache and refresh the page for the user. Super hacky and ugly, but I am out of options. |
I am also trying to play with downgrading vite-plugin-pwa version, because I have a feeling that something was added to the config on the plugin side, and because of that service workers names or something else don't match. |
Downgrading from ^0.16.4 to 0.12.8 helped. It worked! |
uhmm, I'll check changes between those versions, are you using |
Yes, I have the following config:
Look, maybe it was something else, I didn't do a thorough investigation. |
I had version 0.11.13 installed. Then I updated to the latest version of the plugin and added the flag. It didn't work (or maybe I did something incorrectly). Then I downgraded to 0.12.8 and it worked. |
So, we got into a pickle with our web app. I migrated from Webpack to Vite, and because it previously had a web manifest and a service worker, I set one up again with vite-pwa.
This caused a problem, because vite-pwa was returning 404 for a
/blog
route, because it wasn't a defined route in the router. HOWEVER, it was proxied using NGINX to go to another Wordpress site. But the service worker wouldn't even check, it just returned 404.After thinking about it, I realized we didn't really need any kind of offline capability and really it was more trouble than it was worth. We've now tried every strategy we can think of to remove it, and we simply cannot.
If I do a Vite production build, for example, with the service worker. And then I change the service worker setup to:
...and then we run Vite in dev mode, this does not destroy the service worker at all. Refreshing the page loads the service worker, and the service worker throws a ton of errors saying that a bunch of files have 404s (like
.svg
assets), yet all those 404s are for files that should not be retrieved in dev mode. (It's adding hashes to them.)If we tell users to completely clear the cache, our production site works again. But we can't do that in every case. We just want vite-pwa to not exist anymore, and we can't seem to do anything to remove it. In fact, we tried code like:
...which we got from MDN, and tried using this with vite-pwa not loaded, and the service worker seemed to only re-create itself. I guess, because it was cached, it loaded a cached root HTML file, which loaded the cached service worker?
Please, how do we delete this and never think about it again? Right now it's the zombie that never dies.
The text was updated successfully, but these errors were encountered: