@@ -1084,15 +1084,23 @@ If your production web server does not support HTTPS, then the service worker
1084
1084
registration will fail, but the rest of your web app will remain functional.
1085
1085
1086
1086
1 . Service workers are [ not currently supported] ( https://jakearchibald.github.io/isserviceworkerready/ )
1087
- in all web browsers. Service worker registration [ won't be attempted] ( src/register- service-worker.js )
1087
+ in all web browsers. Service worker registration [ won't be attempted] ( src/service-worker-registration .js )
1088
1088
on browsers that lack support.
1089
1089
1090
- 1 . The service worker is only enabled in the [ production environment] ( #Deployment ) ,
1090
+ 1 . The service worker is only enabled in the [ production environment] ( #deployment ) ,
1091
1091
e.g. the output of ` npm run build ` . It's recommended that you do not enable an
1092
1092
offline-first service worker in a development environment, as it can lead to
1093
1093
frustration when previously cached assets are used and do not include the latest
1094
1094
changes you've made locally.
1095
1095
1096
+ 1 . If you * need* to test your offline-first service worker locally, build
1097
+ the application (using ` npm run build ` ) and run a simple http server from your
1098
+ build directory. After running the build script, ` create-react-app ` will give
1099
+ instructions for one way to test your production build locally using
1100
+ ` pushstate-server ` and the [ deployment instructions] ( #deployment ) have
1101
+ instructions for using the python ` SimpleHTTPServer ` . * Be sure to always use an
1102
+ incognito window to avoid complications with your browser cache.*
1103
+
1096
1104
1 . If possible,configure your production environment to serve the generated
1097
1105
` service-worker.js ` [ with HTTP caching disabled] ( http://stackoverflow.com/questions/38843970/service-worker-javascript-update-frequency-every-24-hours ) .
1098
1106
If that's not possible—[ GitHub Pages] ( #github-pages ) , for instance, does not
@@ -1111,7 +1119,7 @@ app works offline!" message) and also let them know when the service worker has
1111
1119
fetched the latest updates that will be available the next time they load the
1112
1120
page (showing a "New content is available; please refresh." message). Showing
1113
1121
this messages is currently left as an exercise to the developer, but as a
1114
- starting point, you can make use of the logic included in [ ` src/register- service-worker.js ` ] ( src/register- service-worker.js ) , which
1122
+ starting point, you can make use of the logic included in [ ` src/service-worker-registration .js ` ] ( src/service-worker-registration .js ) , which
1115
1123
demonstrates which service worker lifecycle events to listen for to detect each
1116
1124
scenario, and which as a default, just logs appropriate messages to the
1117
1125
JavaScript console.
@@ -1122,7 +1130,7 @@ images, or embeds loaded from a different domain. If you would like to use a
1122
1130
runtime caching strategy for those requests, you can [ ` eject ` ] ( #npm-run-eject )
1123
1131
and then configure the
1124
1132
[ ` runtimeCaching ` ] ( https://github.com/GoogleChrome/sw-precache#runtimecaching-arrayobject )
1125
- option in the ` SWPrecachePlugin ` section of
1133
+ option in the ` SWPrecacheWebpackPlugin ` section of
1126
1134
[ ` webpack.config.prod.js ` ] ( ../config/webpack.config.prod.js ) .
1127
1135
1128
1136
## Deployment
0 commit comments