chore: add custom plugin to log errors

This commit is contained in:
userquin 2023-11-02 13:34:29 +01:00
parent 44d0e9c300
commit 40b472ce9d

View file

@ -63,6 +63,19 @@ if (import.meta.env.PROD) {
ignoreVary: true, ignoreVary: true,
}, },
plugins: [ plugins: [
{
fetchDidFail: async ({ error, request }) => {
console.error('webmanifest fetchDidFail', error, request.url)
},
handlerDidError: async ({ error, request }) => {
console.error('webmanifest handlerDidError', error, request.url)
return undefined
},
cacheWillUpdate: async ({ request, response }) => {
console.error('webmanifest cacheWillUpdate', request.url)
return response?.status === 200 ? response : null
},
},
new CacheableResponsePlugin({ statuses: [200] }), new CacheableResponsePlugin({ statuses: [200] }),
// we only need a few entries // we only need a few entries
new ExpirationPlugin({ maxEntries: 100 }), new ExpirationPlugin({ maxEntries: 100 }),