next-with-workbox
next-with-workbox copied to clipboard
Revision value is calculated as MD5 hash of file path, not file contents
The following logic is currently used to calculate the value for revision
when building the list of additionalManifestEntries
that is passed down into the Workbox Webpack Plugin:
https://github.com/cansin/next-with-workbox/blob/e5a222a0c091a6523cf15d554c4d041a39099fda/index.js#L8-L9
Unfortunately, file
in this case is a relative file URL and not the actual contents of the file. This means that the MD5 hash that is being calculated is for a string such as "public/android-chrome-192x192.png"
and not the actual binary contents of the file. This means that if the contents of the file changes it will never actually be recognized by the next version of the app and the older version will continue to be served out of the service worker's cache.
For this plugin to actually work correctly for the static files, it would actually have to read the contents of the file and get the MD5 hash for the actual contents to use as the revision
. Otherwise, the only thing it seems to actually be doing right now for is picking up on new or renamed files.