I'm not a fan of service workers myself. Another team at a previous job added a service worker to a site that served many separate backend apps. It caused endless loading, caching, and crashing problems for my team, for no clear benefit.
If you want a cache, use HTTP caching, not custom JS code.
If you want a cache, use HTTP caching, not custom JS code.