This commit is contained in:
parent
c3bd3a8f6a
commit
4463626232
1 changed files with 9 additions and 9 deletions
|
@ -23,15 +23,6 @@ function onFetch(event: FetchEvent) {
|
||||||
const req = event.request
|
const req = event.request
|
||||||
const url = new URL(req.url)
|
const url = new URL(req.url)
|
||||||
|
|
||||||
if (
|
|
||||||
import.meta.env.PROD
|
|
||||||
&& !IS_SAFARI
|
|
||||||
&& event.request.url.indexOf(`${location.origin}/`) === 0
|
|
||||||
&& event.request.url.match(/\.(js|css|jpe?g|json|wasm|png|mp3|svg|tgs|ico|woff2?|ttf|webmanifest?)(?:\?.*)?$/)
|
|
||||||
) {
|
|
||||||
return event.respondWith(requestCache(event))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (url.pathname.startsWith('/sw/')) {
|
if (url.pathname.startsWith('/sw/')) {
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
handleSwRequest(req, url)
|
handleSwRequest(req, url)
|
||||||
|
@ -41,6 +32,15 @@ function onFetch(event: FetchEvent) {
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
import.meta.env.PROD
|
||||||
|
&& !IS_SAFARI
|
||||||
|
&& event.request.url.indexOf(`${location.origin}/`) === 0
|
||||||
|
&& event.request.url.match(/\.(js|css|jpe?g|json|wasm|png|mp3|svg|tgs|ico|woff2?|ttf|webmanifest?)(?:\?.*)?$/)
|
||||||
|
) {
|
||||||
|
return event.respondWith(requestCache(event))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function register() {
|
function register() {
|
||||||
|
|
Loading…
Reference in a new issue