0

I want to extend native service worker for angular pwa. Task: change all base fetched urls (called origin in sw) It needs for mirrors - on url for all mirrors in sw. I have tried to register custom sw via copy ngsw-worker.js and extend it, but it broke config and updating mechanism for sw (because i have to disable default serviceworker flag in angular.json for exclude default ngsw-worker.js file usage).

  • Welcome to Stack Overflow, Viktor Kolomiets. Please, consider adding some code. It will make it easier for people to help you. For more information, please take a look at [How To Ask](https://stackoverflow.com/help/how-to-ask). – Igor Escodro Dec 10 '19 at 13:34
  • there is no need a code. Its default module of angular. – Viktor Kolomiets Dec 13 '19 at 17:02

1 Answers1

1

ServiceWorkerModule.register('custom-ngsw.js', {enabled: true, registrationStrategy: 'registerImmediately'})

just pass another file and copy whole code from sw. also files can be merged via importScripts('some.js');