Cache Static Assets with Service Workers using sw-precache

Share this video with your friends

Send Tweet

A service worker is a script that runs in the background without access to the UI, and a requisite for a Progressive Web App. They can be used, among others, for caching requests and assets.

Creating a Service Worker is not easy, and can be repetitive to do it for every single app. That’s where sw-precache jumps in, a module for automating the creation of service workers in a declarative way.

This lesson will go through creating a Service Worker using sw-precache.

Rodrigo Andrade
~ 6 years ago

the code for adding the package sw-precache have a typo in the transcript.

Alexander Vu
~ 5 years ago

sw-precache is deprecated. Please migrate to Workbox: https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw

The most parts of this course are outdated.