chore: pre cache locales

This commit is contained in:
Tristan Yang
2022-11-29 23:14:03 +08:00
parent 812b2934db
commit dfb4208984
+12
View File
@@ -61,6 +61,18 @@ registerRoute(
] ]
}) })
); );
// 缓存多语言文件
registerRoute(
({ url }) => url.pathname.startsWith("/locales/"),
new StaleWhileRevalidate({
cacheName: "locales",
plugins: [
// Ensure that once this runtime cache reaches a maximum size the
// least-recently used images are removed.
new ExpirationPlugin({ maxEntries: 100 })
]
})
);
// This allows the web app to trigger skipWaiting via // This allows the web app to trigger skipWaiting via
// registration.waiting.postMessage({type: 'SKIP_WAITING'}) // registration.waiting.postMessage({type: 'SKIP_WAITING'})