fix: 添加 ServiceWorker 旧缓存自动注销与强禁 JS/CSS 强缓存头,解决 Profile-xxx.js 模块映射死锁
This commit is contained in:
parent
d17134b63e
commit
590f37bb79
|
|
@ -138,3 +138,13 @@
|
|||
[2026-07-24 15:33:13,777] [INFO] [unknow:0] GET 200 /favicon.ico
|
||||
[2026-07-24 15:33:14,647] [INFO] [unknow:0] GET 200 /favicon.ico
|
||||
[2026-07-24 15:33:18,057] [INFO] [unknow:0] GET 200 /favicon.ico
|
||||
[2026-07-24 16:00:27,136] [INFO] [unknow:0] GET 200 /gongzidan
|
||||
[2026-07-24 16:00:27,176] [INFO] [unknow:0] GET 200 /.well-known/appspecific/com.chrome.devtools.json
|
||||
[2026-07-24 16:00:27,403] [INFO] [unknow:0] GET 200 /favicon.ico
|
||||
[2026-07-24 16:00:27,518] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user?nonce=a49d469987bfa788782f000e34fec4b9&signature=65508d56db531d301f8b0a2c7f444a65×tamp=1784880027
|
||||
[2026-07-24 16:00:27,520] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user/config?nonce=b78d9b0523acaf32796e2c3f0e4308a1&signature=6f6655d2cce2078a6641eecbd58dd598×tamp=1784880027
|
||||
[2026-07-24 16:00:28,394] [INFO] [unknow:0] GET 200 /gongzidan
|
||||
[2026-07-24 16:00:28,430] [INFO] [unknow:0] GET 200 /.well-known/appspecific/com.chrome.devtools.json
|
||||
[2026-07-24 16:00:28,636] [INFO] [unknow:0] GET 200 /favicon.ico
|
||||
[2026-07-24 16:00:28,753] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user?nonce=687eeb5a709fe2ec7af8cf0e43588b6d&signature=41e9223fbe52216889f8597190bfcf17×tamp=1784880028
|
||||
[2026-07-24 16:00:28,754] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user/config?nonce=e2c74882b519e4afbc46648242cdc524&signature=cdd7b9762921b5e8133552f841286224×tamp=1784880028
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ const matchFile = async (request, response) => {
|
|||
'Content-Type': mimetype,
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
}
|
||||
if (cleanPath.endsWith("-sw.js") || cleanPath.includes("dat-module-map.json")) {
|
||||
if (cleanPath.endsWith(".js") || cleanPath.endsWith(".css") || cleanPath.endsWith("-sw.js") || cleanPath.includes("dat-module-map.json")) {
|
||||
responseHeaders["Service-Worker-Allowed"] = '/'
|
||||
responseHeaders["Cache-Control"] = 'no-cache, no-store, must-revalidate'
|
||||
responseHeaders["Pragma"] = 'no-cache'
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
// 自动清理可能残留的旧版 ServiceWorker 缓存,保障最新代码 Chunk 正常加载
|
||||
if (typeof window !== 'undefined' && 'serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
for (const registration of registrations) {
|
||||
registration.unregister()
|
||||
}
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
|
|
|
|||
Loading…
Reference in New Issue