nuxt-pwa-module: [Bug] No service worker detected
Hey,
Thanks for this module!
I have a question regarding the service worker as it does not seem to be registered by default.
My nuxt.config.ts
pwa: {
manifest: {
name: 'Test',
short_name: 'Test'
},
workbox: {
enabled: true
}
},
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 32 (17 by maintainers)
It wont be that easy π
Basically the issue was that the service worker was not generating. After I run the yarn build it started to work. I dont know it it is a vite cache deps or something else but now it works like a charm.
I think your explanation would be sufficient to fix the issue in the future π
You can maybe include this issue and the result of it in some kind of FAQ section
@kevinmarrec
Reading this comment was a rolercoaster of dramatic action switches π
Awesome that you fixed it! β€οΈ
@Baroshem Even if something strange seems to happened with Nuxt 3 when opt-in the router (using
pagesfolder), I think I need to implement the worker registration in another way to fix this.EDIT: This canβt be fixed yet, it sounds that Vue Router makes window
loadevents fired before Nuxt 3 plugin.EDIT2: Found a fix, will be shipped in v0.3.0
Alright, thanks, I reproduced it.
It seems that this window event listener is never trigerred : https://github.com/kevinmarrec/nuxt-pwa-module/blob/aa01db1679eee3141d8576b24a62b3779f99960e/src/runtime/workbox/plugin.ts#L8
Iβm wondering what is causing this to happen, most likely it can be two things :