diff --git a/doc/source/developer/javascript.rst b/doc/source/developer/javascript.rst index 7a1c5d3975..b471f7dfac 100644 --- a/doc/source/developer/javascript.rst +++ b/doc/source/developer/javascript.rst @@ -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. diff --git a/web/src/registerServiceWorker.js b/web/src/registerServiceWorker.js index 4f95314426..3180adeb70 100644 --- a/web/src/registerServiceWorker.js +++ b/web/src/registerServiceWorker.js @@ -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)