fix cache rule + disable service worker in dev

This commit is contained in:
Felix Roos 2023-02-08 20:32:03 +01:00
parent 3671344867
commit b6e42876ad

View File

@ -37,16 +37,15 @@ export default defineConfig({
globPatterns: ['**/*.{js,css,html,ico,png,svg,json,wav,mp3,ogg}'], globPatterns: ['**/*.{js,css,html,ico,png,svg,json,wav,mp3,ogg}'],
runtimeCaching: [ runtimeCaching: [
{ {
urlPattern: ({ url }) => { urlPattern: ({ url }) =>
[ [
/^https:\/\/raw\.githubusercontent\.com\/.*/i, /^https:\/\/raw\.githubusercontent\.com\/.*/i,
/^https:\/\/freesound\.org\/.*/i, /^https:\/\/freesound\.org\/.*/i,
/^https:\/\/shabda\.ndre\.gr\/.*/i, /^https:\/\/shabda\.ndre\.gr\/.*/i,
].some((regex) => regex.test(url)); ].some((regex) => regex.test(url)),
},
handler: 'CacheFirst', handler: 'CacheFirst',
options: { options: {
cacheName: 'github-files', cacheName: 'external-samples',
expiration: { expiration: {
maxEntries: 5000, maxEntries: 5000,
maxAgeSeconds: 60 * 60 * 24 * 30, // <== 14 days maxAgeSeconds: 60 * 60 * 24 * 30, // <== 14 days