mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-03 07:57:22 +00:00
Fix SW excluding all /_* paths, breaking SvelteKit nsites
The fetch event handler was skipping all paths starting with `/_`, intended to protect iframe-fetch-client system files. But this also excluded SvelteKit asset paths like `/_app/immutable/chunks/*.js`, causing them to bypass JSON-RPC and hit the network directly, which returns HTML instead of JavaScript. Narrow the exclusion to only `/_iframe-client/` — the specific prefix used by the iframe-fetch-client's own assets.
This commit is contained in:
1 file changed
+3
-11
@@ -138,18 +138,10 @@ self.addEventListener("fetch", (event) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Let iframe client system files be handled normally
|
||||
if (url.pathname.startsWith("/_") || url.pathname === "/sw.js") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Let root path be handled normally (loads the iframe client page)
|
||||
if (url.pathname === "/") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Let iframe client assets be handled normally (anything in _iframe-client directory and common assets)
|
||||
// Let iframe client system files and common assets be handled normally
|
||||
if (url.pathname.startsWith("/_iframe-client/") ||
|
||||
url.pathname === "/sw.js" ||
|
||||
url.pathname === "/" ||
|
||||
url.pathname === "/favicon.ico" ||
|
||||
url.pathname === "/manifest.webmanifest") {
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user