fix(build): derive sw.js cache tag from bundle content hash
The service worker uses staleWhileRevalidate on /dist/*, so after a release it would serve old bundles from cache indefinitely (cache is only wiped when the cache *name* changes, which was hardcoded to 'dashcaddy-shell-v10'). Result: dashboard appears unchanged after a self-update until the user manually unregisters the SW. build.js now hashes the concatenated dist bundles and writes `dashcaddy-shell-<10-hex-chars>` into sw.js. Any change in dist/ produces a fresh cache name; on the next page load the SW's activate handler deletes all older caches and the new bundles are fetched.
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
const CACHE = 'dashcaddy-shell-v10';
|
||||
const CACHE = 'dashcaddy-shell-c6600af35d';
|
||||
const PRECACHE = [
|
||||
'/',
|
||||
'/index.html',
|
||||
|
||||
Reference in New Issue
Block a user