DEV Community

loading...

Discussion on: Vue 3, PWA & service worker

Collapse
ang_vues profile image
Ang Vues

Hi Piotr thank you for taking the time to write this. I'm in the same situation - I need to debug the service worker as I'm using it for other background code apart from caching and the dev setup disables the service worker. In the second part of the "Fixing SW on prod" section, you mentioned removing all references to serviceworker-webpack-plugin - but after doing this the DEV server service worker stops working.

I did try to import the Dev service worker manually in main.js but after launching npm run serve, it fails with a 404

Have you encountered this as well? Was there any workaround that worked for you?

Collapse
voodu profile image
Piotr Ładoński Author • Edited

Hi Ang,
Have you tried the first method to fix the production service worker? I.e.

If you don't care about that logging coming from registerServiceWorker.js, just don't import it in src/main.js and problem will be gone.

I must say I had some problems with getting this to work as well and personally decided on using this method