feat(P21PWA2-1,P21PWA2-2,P21PWA2-3): 深链路由守卫/离线审批队列/SW缓存策略升级
这个提交包含在:
+40
-2
@@ -38,11 +38,49 @@ export default defineConfig({
|
||||
},
|
||||
workbox: {
|
||||
navigateFallback: "/index.html",
|
||||
navigateFallbackDenylist: [/^\/api\//],
|
||||
globPatterns: ["**/*.{js,css,html,ico,png,svg,webmanifest}"],
|
||||
runtimeCaching: [
|
||||
{
|
||||
urlPattern: ({ url }) => url.pathname.startsWith("/api/"),
|
||||
handler: "NetworkOnly",
|
||||
urlPattern: ({ request, url }) =>
|
||||
["script", "style", "font", "image"].includes(request.destination) || url.pathname.endsWith(".webmanifest"),
|
||||
handler: "StaleWhileRevalidate",
|
||||
options: {
|
||||
cacheName: "app-static-runtime",
|
||||
cacheableResponse: {
|
||||
statuses: [0, 200],
|
||||
},
|
||||
expiration: {
|
||||
maxEntries: 120,
|
||||
maxAgeSeconds: 7 * 24 * 60 * 60,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
urlPattern: ({ request, url }) => {
|
||||
if (request.method !== "GET") {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
url.pathname === "/api/me" ||
|
||||
url.pathname.startsWith("/api/workflow/tasks") ||
|
||||
url.pathname.startsWith("/api/workflow/approvers") ||
|
||||
url.pathname.startsWith("/api/notifications")
|
||||
);
|
||||
},
|
||||
handler: "NetworkFirst",
|
||||
options: {
|
||||
cacheName: "app-api-runtime",
|
||||
networkTimeoutSeconds: 3,
|
||||
cacheableResponse: {
|
||||
statuses: [200],
|
||||
},
|
||||
expiration: {
|
||||
maxEntries: 80,
|
||||
maxAgeSeconds: 30 * 60,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
在新工单中引用
屏蔽一个用户