@rmdes/indiekit-frontend 1.0.0-beta.37 → 1.0.0-beta.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/serviceworker.js +8 -2
- package/package.json +1 -1
package/lib/serviceworker.js
CHANGED
|
@@ -146,8 +146,14 @@ self.addEventListener("message", (event) => {
|
|
|
146
146
|
self.addEventListener("fetch", (event) => {
|
|
147
147
|
const request = event.request;
|
|
148
148
|
|
|
149
|
-
// Ignore non-GET requests
|
|
150
|
-
|
|
149
|
+
// Ignore cross-origin and non-GET requests.
|
|
150
|
+
// Cross-origin images (avatars, album covers, etc.) must be handled
|
|
151
|
+
// by the browser natively — opaque responses from SW fetch are unreliable
|
|
152
|
+
// and caching them wastes ~7MB each against storage quota.
|
|
153
|
+
if (
|
|
154
|
+
new URL(request.url).origin !== self.location.origin ||
|
|
155
|
+
request.method !== "GET"
|
|
156
|
+
) {
|
|
151
157
|
return;
|
|
152
158
|
}
|
|
153
159
|
|