From 71dca6a5d1909a2b46b64b2b19b223470ffa1b0d Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 23 Jan 2023 21:01:44 +0000 Subject: [PATCH] fix: set NetworkOnly for prefetch --- next.config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/next.config.js b/next.config.js index 4d34e2ee..59570fe2 100644 --- a/next.config.js +++ b/next.config.js @@ -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, ],