I can't set up the service worker for the Jekyll-powered project site - Lighthouse is refusing start_url
value and giving an error Unable to fetch start URL via service worker
app->manifest output shows root /
tried ./index.html
as well - same results. is there a way to pass the audit?
{
"name": "outcast",
"short_name": "outcast",
"icons": [
{
"src": "/assets/images/splsh192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "/assets/images/splsh512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"lang": "en-US",
"display": "standalone",
"background_color": "#131313",
"theme_color": "#f62e1a",
"start_url": "/",
"serviceworker": {
"src": "sw.js",
"scope": "/",
"update_via_cache": "none"
}
}
replacing fetch
handler in sw.js
with the code from official guide fixed the issue. still debugging undefined cache
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request)
.then(function(response) {
// Cache hit - return response
if (response) {
return response;
}
return fetch(event.request);
}
)
);
});