Created by: jeffposnick
This PR adds:
- Service worker generation via
SWPrecacheWebpackPlugin
. - Helper code to conditionally register the service worker if the browser supports it, and if
NODE_ENV === 'production'
. - A web app manifest and a few additional
<meta>
tags to supply metadata, which some mobile browsers use during the Add to Homescreen flow.
Using a server worker with a cache-first strategy offers performance advantages, since the network is no longer a bottleneck for fulfilling navigation requests. It does mean, however, that developers (and users) will only see deployed updates are only visible on the "N+1" visit to a page, since previously cached resources are updated in the background. A good portion of this PR involves updating the documentation to try to explain this model to developers, and make sure that it doesn't catch folks by surprise.
Fixes #192 (closed) & fixes #1086 (closed)
CC: @addyosmani @goldhand @ianschmitz @ryansully who provided comments on a provisional version of this PR.