Skip to content

Commit

Permalink
fix: 修复workbox匹配规则问题
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Dec 25, 2022
1 parent 1f04b0c commit 5624b92
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions client/web/build/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ export function buildRuntimePluginJSResourceCacheGroup(
expiration: number
): RuntimeCaching {
return {
urlPattern: ({ url }) => {
// 使用自定义匹配函数而不是直接传是为了方便解决跨域资源的service worker存储
// 否则需要填入完整的前缀以解决跨域匹配(workbox对此进行了特殊的处理)
return pattern.test(url.pathname);
},
urlPattern: pattern,
// urlPattern: ({ url }) => {
// // 使用自定义匹配函数而不是直接传是为了方便解决跨域资源的service worker存储
// // 否则需要填入完整的前缀以解决跨域匹配(workbox对此进行了特殊的处理)
// return pattern.test(url.pathname);
// },
handler: 'StaleWhileRevalidate' as const,
options: {
cacheName: name,
Expand Down

0 comments on commit 5624b92

Please sign in to comment.