-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable service worker by default #3817
Changes from 2 commits
acdd348
5e15920
c6f3ca2
3402a41
184cec4
da2dce0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ const isLocalhost = Boolean( | |
) | ||
); | ||
|
||
export default function register() { | ||
export function register() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default export still needs to be registerServiceWorker too though (even if both are named exports too) for it to be backwards compatible (even if this lands to a major version update 2.0.0, it would be unneccessary to break everyones build for such a tiny change). Still partial to passing the boolean in myself: #2554 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It won't break anyone's build because this part is copied into every project. Even if we changed completely the API between them, we could've shipped that in any patch release IMO. |
||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { | ||
// The URL constructor is available in all browsers that support SW. | ||
const publicUrl = new URL(process.env.PUBLIC_URL, window.location); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People reading this probably don't know what service worker is.
Can you rewrite this so it's a bit less wordy, and also understandable to most folks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that's a challenge! 😀
I guess we can remove the first sentence and maybe link to that Google page from the docs about what a service worker is. Alternatively we could just link to the "Making a Progressive Web App" section of the CRA docs. I'll work on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking something like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it helps, https://developers.google.com/web/fundamentals/primers/service-workers/ attempts to be a one-stop landing page for a service worker overview, and https://developers.google.com/web/progressive-web-apps/ is a similar landing page for PWAs in general.