sveltejs/sapper

service-worker.js fails when static dir has files starting with dot

phelbas opened this issue · 1 comments

Describe the bug
service-worker.js attempts to cache all the files sapper needs, and ALL the files in static directory but if static has any files starting with . then the add to cache operation fails with a 404 and that silently terminates service-worker, which breaks PWA tests etc, why might files start with a dot? OSX likes to leave files around starting with a dot include .DS_Store

This is related to the default behaviour of serve-static I guess:
https://stackoverflow.com/questions/41343515/serve-static-gives-404-when-a-file-starts-with-dot

service-worker.js has no catch on the addAll so the error is rather silent and deadly.

See the previous discussion in #1095.

The default template uses sirv rather than serve-static, but it also excludes dotfiles by default.

If you think the default service-worker.js should do something specific if cache.addAll(to_cache) fails, please open an issue about that on the sapper-template repo.