v0.8.2 部署缓存确定性:静态资源补齐 Cache-Control(哈希产物 immutable,入口/SW no-cache),SW 导航强制校验并升级缓存版本

This commit is contained in:
root
2026-11-01 22:32:36 +08:00
parent 2ee5f5760f
commit 5909eabba8
9 changed files with 23 additions and 13 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
const CACHE = 'intern-log-v1'
const CACHE = 'intern-log-v2'
const CORE = ['./', './index.html']
self.addEventListener('install', event => {
@@ -22,7 +22,7 @@ self.addEventListener('fetch', event => {
// 页面导航:网络优先,离线回退缓存的应用壳
if (req.mode === 'navigate') {
event.respondWith(
fetch(req)
fetch(req, { cache: 'no-cache' })
.then(resp => {
const clone = resp.clone()
caches.open(CACHE).then(c => c.put('./index.html', clone))