The workbox-sw module provides an extremely easy way to get up and running
with the Workbox modules, simplifies the loading of the Workbox modules, and
offers some simple helper methods.
You can use workbox-sw via our CDN or you use it with a set of workbox files
on your own server.
Using Workbox SW via CDN
The easiest way to start using this module is via the CDN. You just need to add the following to your service worker:
importScripts(
'https://storage.googleapis.com/workbox-cdn/releases/6.4.1/workbox-sw.js'
);
With this you'll have the workbox namespace in your service worker that will
provide access to all of the Workbox modules.
workbox.precaching.*
workbox.routing.*
etc
There is some magic that happens as you start to use the additional modules.
When you reference a module for the first time, workbox-sw will detect this
and load the module before making it available. You can see this happening in
the network tab in DevTools.