pcb icon indicating copy to clipboard operation
pcb copied to clipboard

Better default for `version`

Open mxstbr opened this issue 6 years ago • 1 comments

Right now, version defaults to the time and date of the last build. As the docs note, this is definitely not ideal: (emphasis mine)

Please note that if you use the default value (date and time), the version of service worker will change on each build of your project.

There should be a better default for this that doesn't update the cache on every single deploy, even if nothing changed. What about using a hash of all the filenames and the ServiceWorker file contents? This would mean the version of the cache only changes if the cached files or the ServiceWorker file changes, which seems like a sensible time to update the cache version to me.

mxstbr avatar Jun 27 '18 09:06 mxstbr

Well, it might be done. But there no real problem in current situation. It's possible to change version to '[hash]' and it will use hash of the build as the version. Also, offline-plugin automatically calculates hashes for all your files (unless external, which can't be tracked) and updates only those what changed. Hence, it's kinda better to update more often. Unnecessary files won't be downloaded.

NekR avatar Sep 29 '18 19:09 NekR