Can't stop service-worker.js from being served

I a messing around with a new Ionic 2 app and un-commented the code:
`

`

in index.html to test out the service-worker.js feature.

Now I am trying to unregister that service-worker. I have re-commented the code and even deleted service-worker.js. I have cleared the cache in my browser and specifically terminated the service worker via the chrome tab: chrome://inspect/#service-workers

Still, every time I initially run ionic serve it shows serve /service-worker.js right after it finishes launching. However, if I refresh the page in chrome then it reloads without the service-worker. But no matter what I do, the next time I run ionic serve it redeploys the service-worker.

Any help would be greatly appreciated!

Thanks,
Daniel

1 Like

I ran into the same issue head first and I’m still looking for a proper solution.
However, you can uninstall the service worker here:
chrome://serviceworker-internals/

maybe the first line in the service-worker.js file itself? Didn’t help me though…
// tick this to make the cache invalidate and update const CACHE_VERSION = 2; const CURRENT_CACHES = { 'read-through': 'read-through-cache-v' + CACHE_VERSION };

5 Likes

Yay, that’s what I needed to do, thanks!

helped me as well, thanks!!

what we have to do in
chrome://serviceworker-internals/

Not 100% if this is what to do, but I just selected “Bypass for network” in Chrome’s inspector, under the Application tab, in Service Workers, and now ionic serve is working again

Damn I was going crazy over this and having to delete the cache every time I made changes, just because I enabled the service worker in one of my project once to test… NO MORE SERVICE WORKER