Our service workers webpushr-sw.js
will attempt to overwrite other service workers that are registered with the topmost (site root) scope. Would it be possible to import your other service workers into our service worker?
Here’s how to do that:
webpushr-sw.js contains the following by default:
importScripts('https://cdn.webpushr.com/sw-server.min.js');
Please modify the content of webpushr-sw.js
to import your other service worker files like this:
importScripts('https://example.com/my-other-service-worker.js');
importScripts('https://cdn.webpushr.com/sw-server.min.js');
We recommend the above approach instead of importing our service worker into another file because our web SDK will attempt to overwrite other service workers.
Remember to remove the non-Webpushr service worker file from your server and also point your existing code (that is pointing to the non-webpushr service worker file) to webpushr service worker file (webpushr-sw.js).
More on service workers can be read here.