Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
5a336ad1
Commit
5a336ad1
authored
7 years ago
by
captDaylight
Committed by
Dan Abramov
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Updating the Service Worker opt-out documentation (#3108)
parent
15d8e53d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/react-scripts/template/README.md
+8
-4
packages/react-scripts/template/README.md
with
8 additions
and
4 deletions
+8
-4
packages/react-scripts/template/README.md
+
8
-
4
View file @
5a336ad1
...
...
@@ -1628,14 +1628,18 @@ that your web app is reliably fast, even on a slow or unreliable network.
### Opting Out of Caching
If you would prefer not to enable service workers prior to your initial
production deployment, then remove the call to
`
s
erviceWorker
Registration.register
()`
production deployment, then remove the call to
`
registerS
erviceWorker()`
from
[
`src/index.js`
](
src/index.js
)
.
If you had previously enabled service workers in your production deployment and
have decided that you would like to disable them for all your existing users,
you can swap out the call to
`serviceWorkerRegistration.register()`
in
[
`src/index.js`
](
src/index.js
)
with a call to
`serviceWorkerRegistration.unregister()`
.
After the user visits a page that has
`serviceWorkerRegistration.unregister()`
,
you can swap out the call to
`registerServiceWorker()`
in
[
`src/index.js`
](
src/index.js
)
first by modifying the service worker import:
```
javascript
import
{
unregister
}
from
'
./registerServiceWorker
'
;
```
and then call
`unregister()`
instead.
After the user visits a page that has
`unregister()`
,
the service worker will be uninstalled. Note that depending on how
`/service-worker.js`
is served,
it may take up to 24 hours for the cache to be invalidated.
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment