0

Fix custom runtimeCaching rules, default runtimeCaching rule order (#3685)

Co-authored-by: Muaz Ahmad <mahmad2000@protonmail.com>
This commit is contained in:
mahmed2000 2024-04-15 03:41:39 +05:00 committed by GitHub
parent aa4a3024d9
commit 1a5e7cb113
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,19 +8,22 @@ const runtimeCaching = require('next-pwa/cache');
const withPWA = require('next-pwa')({
dest: 'public',
runtimeCaching: [
...runtimeCaching,
{
urlPattern: /\.(?:ts|m3u8)$/i,
handler: 'NetworkOnly',
},
{
urlPattern: /^\/admin\/.*$/,
urlPattern: (url) => { return url.pathname.startsWith("/admin/"); },
handler: 'NetworkOnly',
options: {
fetchOptions: { credentials: 'same-origin' }
}
},
{
urlPattern: /^\/api\/.*$/,
urlPattern: (url) => { return url.pathname.startsWith("/api/"); },
handler: 'NetworkOnly',
},
...runtimeCaching,
],
register: true,
skipWaiting: true,