Add second Service Worker to PWA starter kit??



  • How to add a second service worker to the Quasar PWA Starter kit, besides the one that’s included in the kit?

    I tried to add a myServiceWorker.js in the dist folder and then in main.js in the src folder I added:

    // SERVICE WORKERS
    if ('serviceWorker' in navigator)
    {
    	navigator.serviceWorker
    	.register('/sw.js')
    	.then(()=>{
    		console.log('service worker is registered!');
    	});
    }
    

    This shows me that the service worker is registered. I see in the console log:

    service worker is registered!

    However the service worker is nowhere to be found in the ‘Application’ tab of the dev tools…

    Any ideas for me?


  • Admin

    First, why do you need a second service worker? This is not how PWAs work.
    Second, you have the service workers in /build folder.


Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.