I am using sw-precache
to allow pre-caching of all static resources of an Angular app. I understood the sw-precache concept of versioning by calculating the MD5 hash which is used to determine whether the file has changed or not.
But I'm wondering how will we handle versioning/cache busting through sw-precache
on bundle file (say bundle.877095ebde8.js) that generated by concatenating multiples files and minify them and versioning file.
Since in this case, Instead of file content, the whole file will be change each time you made any changes and create a new versioning file, due to which navigator.serviceWorker.controller
always returns null.
Service worker.controller won't always be null. Sw-precache will build you a new service worker when you change these files and browsers will update to use the new service worker.
Granted, it feels like there could be a smarter versioning for sw-precache in this scenario - maybe raise an issue on the repo.