Commit 0e51eef6 authored by Ian Sutherland's avatar Ian Sutherland Committed by Dan Abramov
Browse files

Disable service worker by default (#3817)

* WIP disable service worker by default (#2554)

* Updated service worker registration

* Readd default export in registerServiceWorker.js

* Updated comments about using Service Worker

* Call it serviceWorker

* Nits
parent 864874bf
3 merge requests!12191Lim.Pisey.168:/Identified - We are currently investigating reports of missing build logs. The issue has been identified and a resolution is in progress. We will provide a further update when available.Mar 21, 09:02 UTC,!12853brikk,!5717Automatically extract project file structure from build bundle file
Showing with 7 additions and 3 deletions
+7 -3
...@@ -2,7 +2,11 @@ import React from 'react'; ...@@ -2,7 +2,11 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import './index.css'; import './index.css';
import App from './App'; import App from './App';
import registerServiceWorker from './registerServiceWorker'; import * as serviceWorker from './serviceWorker';
ReactDOM.render(<App />, document.getElementById('root')); ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/2vJdu84
serviceWorker.unregister();
...@@ -18,7 +18,7 @@ const isLocalhost = Boolean( ...@@ -18,7 +18,7 @@ const isLocalhost = Boolean(
) )
); );
export default function register() { export function register() {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW. // The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location); const publicUrl = new URL(process.env.PUBLIC_URL, window.location);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment