v0.8.2 部署缓存确定性:静态资源补齐 Cache-Control(哈希产物 immutable,入口/SW no-cache),SW 导航强制校验并升级缓存版本
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user