How to add custom code to ServiceWorker

buhrmi
58
buhrmi
commented 2 years ago

I can't find a way to add custom code (eg push notifications, etc.) to the service worker when using the pwa (workbox) nuxt module. Is there a way?

0
pi0
29.5k
pi0
commented 2 years ago

Hey. Last time I've checked workbox web pack plugin there was no easy way unless writing a custom sw.js template. But try to investigate more possible ways soon :)

0
buhrmi
58
buhrmi
commented 2 years ago

How about changing the module to the workbox-build-webpack-plugin instead of the normal workbox-webpack-plugin?

0
buhrmi
58
buhrmi
commented 2 years ago

ah, wait, it's the same … just got confused because I saw it has a swSrc config options and workbox-webpack-plugin didn't have it

0
buhrmi
58
buhrmi
commented 2 years ago

Closing this because my last comments don't make sense. Will open a more eloquent issue later.

0
Informations
QuestionUnresolved
#c4 - Created 2 years ago