Fix custom runtimeCaching rules, default runtimeCaching rule order (#3685)
Co-authored-by: Muaz Ahmad <mahmad2000@protonmail.com>
This commit is contained in:
parent
aa4a3024d9
commit
1a5e7cb113
@ -8,19 +8,22 @@ const runtimeCaching = require('next-pwa/cache');
|
|||||||
const withPWA = require('next-pwa')({
|
const withPWA = require('next-pwa')({
|
||||||
dest: 'public',
|
dest: 'public',
|
||||||
runtimeCaching: [
|
runtimeCaching: [
|
||||||
...runtimeCaching,
|
|
||||||
{
|
{
|
||||||
urlPattern: /\.(?:ts|m3u8)$/i,
|
urlPattern: /\.(?:ts|m3u8)$/i,
|
||||||
handler: 'NetworkOnly',
|
handler: 'NetworkOnly',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
urlPattern: /^\/admin\/.*$/,
|
urlPattern: (url) => { return url.pathname.startsWith("/admin/"); },
|
||||||
handler: 'NetworkOnly',
|
handler: 'NetworkOnly',
|
||||||
|
options: {
|
||||||
|
fetchOptions: { credentials: 'same-origin' }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
urlPattern: /^\/api\/.*$/,
|
urlPattern: (url) => { return url.pathname.startsWith("/api/"); },
|
||||||
handler: 'NetworkOnly',
|
handler: 'NetworkOnly',
|
||||||
},
|
},
|
||||||
|
...runtimeCaching,
|
||||||
],
|
],
|
||||||
register: true,
|
register: true,
|
||||||
skipWaiting: true,
|
skipWaiting: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user