Search code examples
angularangular-service-worker

Angular: Is it possible to switch off offline support and use only swUpdate service for ServiceWorkers?


service workers are installed with standard schematics:

ng add @angular/pwa

Is it possible to switch off offline support, to use only SwUpdate service?


Solution

  • You can disable Angular Service Worker from serving all or some resources from cache by specifying your custom "navigationUrls" in ngsw-config.json. For example

    "navigationUrls": []
    

    Documentation

    I also noticed that in that case you have to trigger checkForUpdate() method explicitly (for example, on the app init or with some cadence)