Merge pull request #419 from tidalcycles/pwa

add caching strategy for missing file types + cache all samples loaded from github
This commit is contained in:
Felix Roos 2023-02-07 22:08:01 +01:00 committed by GitHub
commit 9d661808ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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,
},