更新vite.config.ts,增加页面缓存配置

This commit is contained in:
jxxghp
2025-07-04 16:39:31 +08:00
parent edc0949bed
commit 12b463d9e8
+14 -3
View File
@@ -67,14 +67,24 @@ export default defineConfig({
options: { options: {
cacheName: 'image-cache', cacheName: 'image-cache',
expiration: { expiration: {
maxEntries: 50, maxEntries: 100,
maxAgeSeconds: 30 * 24 * 60 * 60, // 缓存 30 天 maxAgeSeconds: 30 * 24 * 60 * 60,
}, },
}, },
}, },
{
urlPattern: ({ request }) => request.destination === 'document',
handler: 'NetworkFirst',
options: {
cacheName: 'pages-cache',
networkTimeoutSeconds: 10,
},
},
], ],
navigateFallback: '/index.html', // 确保页面路由正确加载 navigateFallback: '/index.html',
navigateFallbackDenylist: [/.*\/api\/v\d+\/system\/logging.*/], navigateFallbackDenylist: [/.*\/api\/v\d+\/system\/logging.*/],
skipWaiting: true,
clientsClaim: true,
}, },
injectManifest: { injectManifest: {
rollupFormat: 'iife', rollupFormat: 'iife',
@@ -131,6 +141,7 @@ export default defineConfig({
'client_mode': 'navigate-existing', 'client_mode': 'navigate-existing',
}, },
'handle_links': 'preferred', 'handle_links': 'preferred',
'id': 'moviepilot-app',
'shortcuts': [ 'shortcuts': [
{ {
'name': '推荐', 'name': '推荐',