I am playing around with service workers. I currently have the following service worker:
const CACHE_NAME = 'my-site-cache-v1';
const urlsToCache = [
'index.html',
'app.bundle.js',
'images/image.jpg'
];
self.addEventListener('install', function(event) {
console.log("install");
// Perform install steps
event.waitUntil(
caches.open(CACHE_NAME).then(function(cache) {
console.log('Opened cache');
return cache.addAll(urlsToCache);
})
);
});
However I use webpack to add a hash to all the files when building. This means I do not know which urls to cache in the service worker.
I am not sure how to get around this.