Skip to content

Latest commit

 

History

History
55 lines (28 loc) · 2.61 KB

troubleshooting.md

File metadata and controls

55 lines (28 loc) · 2.61 KB

offline-plugin isn't working


The ServiceWorker is not being updated

Make sure the ServiceWorker (sw.js) is not being cached by the server (Cache-Control: no-store) and that it has a deterministic name (no hashing).

AppCache is being used instead of ServiceWorker

Make sure your webapp is served with HTTPS (or localhost for development).

I cannot see any changes in my browser

Make sure the browser has cached the latest resources, follow the steps outlined in the updates doc.

ServiceWorker isn't being updated automatically

Automatic updates isn't the default behavior, but can be achieved using the autoUpdate option

All routes/resources aren't being cached

offline-plugin automatically caches all resources generated by webpack. Any other resource needs to be explicitly cached as external.

Some pages / resources are not being served at all

The ServiceWorker can only serve resources within its scope. Serve your sw file from the root of your public folder, or supply the correct ServiceWorker.scope option.

The ServiceWorker gets overridden by another app on the same domain

Specify a unique ServiceWorker.cacheName to avoid it being overridden.

offline-plugin isn't working in dev mode

webpack-dev-server compatibility is unknown for the moment, so if you are using hot reloading, ServiceWorker might not work as it's supposed to.

cookies are not included in the ServiceWorker pre-fetch request

Make sure you are using the correct prefetchRequest.credentials to allow for cookies.

ServiceWorker doesn't work for subpages

offline-plugin is probably not configured to handle these routes. See the appShell option.

ServiceWorker is wrongly caching api requests

There are multiple ways to fix this depending on your setup. One way is to set cacheMaps.requestTypes to ['navigate'], caching only those requests.

AppCache events are not working properly

AppCache.events are known to be a bit buggy (see updates). Try to avoid using them if possible.

Resources served from a CDN are not being cached

offline-plugin can cache resources served from a CDN, given the correct configuration. Make sure the resources are served with the correct headers.