fix(pwa): add offline fallback route

This commit is contained in:
2026-06-30 15:08:18 +08:00
parent ba6ce57e62
commit 2c96d5144c
2 changed files with 88 additions and 4 deletions
+4 -4
View File
@@ -17,9 +17,9 @@
* - clientsClaim: true 新 SW 立即接管所有打开的 client
* - navigationPreload: 用 preload API 加速文档请求(资源请求 SW 完成前先发)
*
* Offline fallback`/~offline` 路由(next.config.ts Serwist 配置里也登记了
* `additionalPrecacheEntries`,双保险)。注意本项目目前**没实现**这个路由,
* 真要落地需要新增 src/app/~/offline/page.tsx —— 未做
* Offline fallback`/~offline` 路由(serwist route handler 里也登记了
* `additionalPrecacheEntries`,双保险)。对应页面:
* `src/app/~offline/page.tsx`
*/
import { defaultCache } from "@serwist/turbopack/worker";
import type { PrecacheEntry, SerwistGlobalConfig } from "serwist";
@@ -51,4 +51,4 @@ const serwist = new Serwist({
},
});
serwist.addEventListeners();
serwist.addEventListeners();