fix: set NetworkOnly for prefetch

This commit is contained in:
DIYgod 2023-01-23 21:01:44 +00:00
parent f84336181a
commit 71dca6a5d1
No known key found for this signature in database
1 changed files with 7 additions and 0 deletions

View File

@ -10,6 +10,7 @@ const cache = require("next-pwa/cache")
const withPWA = require("next-pwa")({
dest: "public",
publicExcludes: ["*"],
dynamicStartUrl: false,
runtimeCaching: [
{
urlPattern: ({ url }) => {
@ -38,6 +39,12 @@ const withPWA = require("next-pwa")({
},
},
},
{
urlPattern: ({ request }) => {
return request.headers.get("x-middleware-prefetch")
},
handler: "NetworkOnly",
},
// @ts-ignore
...cache,
],