Answer
How do you debug a service worker?
Open Chrome DevTools → Application tab → Service Workers panel. It shows the registered worker’s status (activated, waiting, redundant), lets you check "Update on reload" to force a fresh install every load, simulate offline mode, and unregister a stuck worker. Console logs from inside the worker appear in the main console when you select the worker’s context from the dropdown.
Common debugging steps
Check "Update on reload" during development so every refresh installs and activates the latest worker instead of serving a stale cached version.
Inspecting cache contents
Application → Cache Storage lists every named cache and its stored request/response pairs, useful for verifying what actually got precached.
Simulating offline
The Network tab’s throttling dropdown includes "Offline", which is the fastest way to verify your offline fallback actually works.