Angular Service Worker (ngsw) or Workbox

804 views Asked by At

Please let me ask a question.

Firstly,I would like to build angular progressive web app.
And I found that I can use angular native service worker (ngsw) or also framework-agnostic library called Workbox to build progressive web app.
Which approach is easier to start with, which library is simpler to use, and which resulting PWA is more convenient to maintain.

Which library should I use ,please advice me(ngsw or workbox)

Please can somebody explain with pros and cons.

1

There are 1 answers

0
Pizaranha On

I took this information from the International Javascript Conference and the Angular University.

Both have been created for the same purpose, to implement a service worker in your projects, ngsw is easier and workbox is more configurable.

Angular Service Worker (ngsw)

  • Easy to start ng add @angular/pwa --project <name of project as in angular.json>
  • Seamless integration with angular
  • Coding-free basic features
  • Angular-friendly approach

In a sentence...

ngsw is everything the Angular team thinks a project needs to implement a service worker.

Workbox

  • Framework-agnostic npm install workbox-build --save-dev
  • Rich functionality
  • Maximum flexible configuration
  • Full power of your own service worker

In a sentence...

workbox helps you create a fully configurable service worker. It's like ngsw but on steroids.