add caching strategy for missing file types

+ cache all samples loaded from github
This commit is contained in:
Felix Roos 2023-02-07 21:50:08 +01:00
parent 3d27a5f8c7
commit 6a5d849b3c

View File

@ -31,6 +31,27 @@ export default defineConfig({
mdx(options),
tailwind(),
AstroPWA({
registerType: 'autoUpdate',
injectRegister: 'auto',
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,json,wav,mp3,ogg}'],
runtimeCaching: [
{
urlPattern: /^https:\/\/raw\.githubusercontent\.com\/.*/i,
handler: 'CacheFirst',
options: {
cacheName: 'github-files',
expiration: {
maxEntries: 200,
maxAgeSeconds: 60 * 60 * 24 * 30, // <== 14 days
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
],
},
devOptions: {
enabled: true,
},