From 53215406b370f2e4da13f69fc35ae8d1b0df8908 Mon Sep 17 00:00:00 2001 From: Tristan Yang Date: Tue, 6 Jun 2023 21:09:30 +0800 Subject: [PATCH] build: add ignore cache path --- src/service-worker.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/service-worker.ts b/src/service-worker.ts index 21db44a3..8000b955 100644 --- a/src/service-worker.ts +++ b/src/service-worker.ts @@ -31,19 +31,19 @@ registerRoute( // If this isn't a navigation, skip. if (request.mode !== "navigate") { return false; - } // If this is a URL that starts with /_, skip. + } const urlPath = url.pathname; - // 忽略api开头的path 本地语言文件 挂件地址 + // 忽略api开头的path 本地语言文件 挂件地址 以及版本号 /_开头的path if ( + urlPath.startsWith("/_") || + urlPath.startsWith("/VERSION") || urlPath.startsWith("/api") || urlPath.startsWith("/locales/") || urlPath.startsWith("/widget") ) { return false; } - if (urlPath.startsWith("/_")) { - return false; - } // If this looks like a URL for a resource, because it contains // a file extension, skip. + // If this looks like a URL for a resource, because it contains // a file extension, skip. if (urlPath.match(fileExtensionRegexp)) { return false;