vite-pwa / vite-plugin-pwa

Zero-config PWA for Vite
https://vite-pwa-org.netlify.app/
MIT License
3.22k stars 211 forks source link

Adding a second service worker breaks the app by constantly reloading it #777

Open mtnair opened 3 weeks ago

mtnair commented 3 weeks ago

We recently wanted to add the Firebase Messaging Service Worker to our app, but when doing so, the app keeps reloading constantly after an update of the has been released. I created a demo repo which should demonstrate the problem, please have a look: https://github.com/mtnair/vite-pwa-firebase-sw I also recorded a short screen cap for you to see the behavior we are experiencing: https://imgur.com/a/8WQbUJX

The only things changed in this demo repository are:

I also found this issue. I suspect the suggested solution in this issue would help us too, but I don't really know how to create our own service worker based on the default service worker from vite-plugin-pwa (which we're pretty happy with) to not break anything. The documentation has not really helped me customizing the default sw.

Any help or hint into the right direction is much appreciated!