cacheableresponse plugin fixes img sw cache
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
326ce2ba68
commit
cb233f4ccb
@ -44,6 +44,7 @@
|
|||||||
"use-long-press": "^3.2.0",
|
"use-long-press": "^3.2.0",
|
||||||
"use-sync-external-store": "^1.2.0",
|
"use-sync-external-store": "^1.2.0",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
|
"workbox-cacheable-response": "^7.0.0",
|
||||||
"workbox-core": "^6.4.2",
|
"workbox-core": "^6.4.2",
|
||||||
"workbox-expiration": "^7.0.0",
|
"workbox-expiration": "^7.0.0",
|
||||||
"workbox-precaching": "^7.0.0",
|
"workbox-precaching": "^7.0.0",
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
/// <reference lib="webworker" />
|
/// <reference lib="webworker" />
|
||||||
|
import { CacheableResponsePlugin } from "workbox-cacheable-response";
|
||||||
|
|
||||||
declare const self: ServiceWorkerGlobalScope & {
|
declare const self: ServiceWorkerGlobalScope & {
|
||||||
__WB_MANIFEST: (string | PrecacheEntry)[];
|
__WB_MANIFEST: (string | PrecacheEntry)[];
|
||||||
};
|
};
|
||||||
@ -53,6 +55,9 @@ registerRoute(
|
|||||||
ignoreVary: true,
|
ignoreVary: true,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
new CacheableResponsePlugin({
|
||||||
|
statuses: [0, 200],
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -61,7 +66,7 @@ registerRoute(
|
|||||||
({ url }) => url.origin === "https://api.snort.social" && url.pathname.startsWith("/api/v1/preview"),
|
({ url }) => url.origin === "https://api.snort.social" && url.pathname.startsWith("/api/v1/preview"),
|
||||||
new StaleWhileRevalidate({
|
new StaleWhileRevalidate({
|
||||||
cacheName: "preview-cache",
|
cacheName: "preview-cache",
|
||||||
plugins: [new ExpirationPlugin({ maxAgeSeconds: 4 * 60 * 60 })],
|
plugins: [new ExpirationPlugin({ maxAgeSeconds: 24 * 60 * 60 })],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -3002,6 +3002,7 @@ __metadata:
|
|||||||
vite-plugin-pwa: ^0.17.0
|
vite-plugin-pwa: ^0.17.0
|
||||||
vite-plugin-version-mark: ^0.0.10
|
vite-plugin-version-mark: ^0.0.10
|
||||||
vitest: ^0.34.6
|
vitest: ^0.34.6
|
||||||
|
workbox-cacheable-response: ^7.0.0
|
||||||
workbox-core: ^6.4.2
|
workbox-core: ^6.4.2
|
||||||
workbox-expiration: ^7.0.0
|
workbox-expiration: ^7.0.0
|
||||||
workbox-precaching: ^7.0.0
|
workbox-precaching: ^7.0.0
|
||||||
@ -11959,7 +11960,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"workbox-cacheable-response@npm:7.0.0":
|
"workbox-cacheable-response@npm:7.0.0, workbox-cacheable-response@npm:^7.0.0":
|
||||||
version: 7.0.0
|
version: 7.0.0
|
||||||
resolution: "workbox-cacheable-response@npm:7.0.0"
|
resolution: "workbox-cacheable-response@npm:7.0.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
Loading…
Reference in New Issue
Block a user