Workbox comes with a CLI to generate a Service Worker based on your configuration. You specify what file types to precache in what folders. Install it locally or globally. All you have to do is run a single command. Workbox will take you through a set of questions to help set up your Service Worker.