From b400db8216dd47ac1e9f02547ac417d86244eaf1 Mon Sep 17 00:00:00 2001 From: William Blythe Date: Fri, 4 Jan 2019 08:01:02 +1100 Subject: [PATCH] only cache if not 404 --- src/sw.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sw.js b/src/sw.js index 5eb5d3e0..9a724691 100644 --- a/src/sw.js +++ b/src/sw.js @@ -8,7 +8,13 @@ if (workbox) { workbox.routing.registerRoute( new RegExp('/(.*?)'), - workbox.strategies.staleWhileRevalidate() + workbox.strategies.staleWhileRevalidate({ + plugins: [ + new workbox.cacheableResponse.Plugin({ + statuses: [0, 200] + }) + ] + }) ); workbox.routing.registerRoute(