Workbox can generate a complete service worker that supports precaching and set up runtime caching purely from a configuration object or file. This is a great option for anyone looking for an easy solution and works really well for static sites.
You can generate a service worker using the CLI, workbox-build Node module or with the webpack plugin.
Depending on how you build your site, you’ll need to select the right tool for
you. The CLI is easiest to get up and running with. The Node Module
workbox-build is useful if you have a build process that runs in node,
like Gulp. If you use webpack, the Workbox plugin will be the best fit.
Workbox Command Line Interface (CLI)
Ideal for developers who are unfamiliar with Node or have simple needs.
Perfect for developers wanting to programmatically generate the service worker in Node or are using Gulp for their build process.
Workbox Webpack Plugin
Ideal for developers using webpack to build their project.