Merge "Optionally disable service worker in zuul-web"
This commit is contained in:
commit
654328f568
|
@ -192,3 +192,7 @@ As long as `yarn`_ is installed, the installation of zuul will run
|
|||
.. _React: https://reactjs.org/
|
||||
.. _Patternfly: https://www.patternfly.org/
|
||||
.. _create-react-app: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md
|
||||
|
||||
In some cases there is the need to disable the service worker which does
|
||||
advanced caching. In order to do that set the environment variable
|
||||
``REACT_APP_DISABLE_SERVICE_WORKER=true`` during installation.
|
||||
|
|
|
@ -21,6 +21,11 @@ const isLocalhost = Boolean(
|
|||
)
|
||||
|
||||
export default function register () {
|
||||
if (process.env.REACT_APP_DISABLE_SERVICE_WORKER === 'true') {
|
||||
console.log('Disabled service worker')
|
||||
return
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue