@@ -1087,12 +1087,20 @@ registration will fail, but the rest of your web app will remain functional.
1087
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
0 commit comments