Skip to content

Commit

Permalink
Disable service worker (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
zwass authored Jun 23, 2022
1 parent 0b604b1 commit 4a741aa
Show file tree
Hide file tree
Showing 4 changed files with 849 additions and 521 deletions.
30 changes: 11 additions & 19 deletions config/webpackDevServer.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
'use strict';
'use strict'

const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
const ignoredFiles = require('react-dev-utils/ignoredFiles');
const config = require('./webpack.config.dev');
const paths = require('./paths');
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware')
const ignoredFiles = require('react-dev-utils/ignoredFiles')
const config = require('./webpack.config.dev')
const paths = require('./paths')

const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
const host = process.env.HOST || '0.0.0.0';
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http'
const host = process.env.HOST || '0.0.0.0'

module.exports = function(proxy, allowedHost) {
return {
Expand All @@ -27,8 +26,7 @@ module.exports = function(proxy, allowedHost) {
// So we will disable the host check normally, but enable it if you have
// specified the `proxy` setting. Finally, we let you override it if you
// really know what you're doing with a special environment variable.
disableHostCheck:
!proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
disableHostCheck: !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
// Enable gzip compression of generated files.
compress: true,
// Silence WebpackDevServer's own logs since they're generally not useful.
Expand Down Expand Up @@ -83,13 +81,7 @@ module.exports = function(proxy, allowedHost) {
proxy,
before(app) {
// This lets us open files from the runtime error overlay.
app.use(errorOverlayMiddleware());
// This service worker file is effectively a 'no-op' that will reset any
// previous service worker registered for the same host:port combination.
// We do this in development to avoid hitting the production cache if
// it used the same host and port.
// https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432
app.use(noopServiceWorkerMiddleware());
app.use(errorOverlayMiddleware())
},
};
};
}
}
3 changes: 0 additions & 3 deletions public/_headers
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
/service-worker.js
Cache-Control: no-cache
Max-Age: 0
2 changes: 0 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom'
import registerServiceWorker from './registerServiceWorker'
import 'react-select/dist/react-select.css'

import './index.css'

import Router from 'Router'

ReactDOM.render(<Router />, document.getElementById('root'))
registerServiceWorker()
Loading

0 comments on commit 4a741aa

Please sign in to comment.