When your project requires to implement strict security policies in some cases it is necessary to disable hashes, for this reason we need another option to clear all caches.
however I agree that this method could be shorter, in my opinion only need attach in the serviceWorker.js a console.log with current date
With these lines you can add a console.log, I have used the current date to ensure a new value is different to the last version, but you can use another value
The reason of this is very simple, own service worker update all cache our app but need at least one change to download the new version of this file, the console.log with a date is perfect, it will be diferent in each build.
When your project requires to implement strict security policies in some cases it is necessary to disable hashes, for this reason we need another option to clear all caches.
however I agree that this method could be shorter, in my opinion only need attach in the serviceWorker.js a console.log with current date
Hi Arturo
I'm extremely sorry for such a late reply. Can you help me out how I can make this code shorter ?
Of course, as I commented only need attach a console log in your service worker, for example:
Create a file updateBuildTime.js
then update your package file with
With these lines you can add a console.log, I have used the current date to ensure a new value is different to the last version, but you can use another value
The reason of this is very simple, own service worker update all cache our app but need at least one change to download the new version of this file, the console.log with a date is perfect, it will be diferent in each build.
Thanks Arturo, I will check this out.