Skip to content

Commit

Permalink
Fix local dev server (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
nimzco authored Jul 25, 2024
1 parent 8a597fd commit 7ade7bd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 97 deletions.
68 changes: 0 additions & 68 deletions config/getHttpsConfig.js

This file was deleted.

29 changes: 0 additions & 29 deletions config/webpackDevServer.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
/* eslint-disable space-before-function-paren */
'use strict'

const fs = require('fs')

const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware')
const ignoredFiles = require('react-dev-utils/ignoredFiles')
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware')
const redirectServedPath = require('react-dev-utils/redirectServedPathMiddleware')

const getHttpsConfig = require('./getHttpsConfig')
const paths = require('./paths')

const host = process.env.HOST || '0.0.0.0'
Expand Down Expand Up @@ -94,7 +88,6 @@ module.exports = function (proxy, allowedHost) {
publicPath: paths.publicUrlOrPath.slice(0, -1),
},

https: getHttpsConfig(),
host,
historyApiFallback: {
// Paths with dots should still use the history fallback.
Expand All @@ -104,27 +97,5 @@ module.exports = function (proxy, allowedHost) {
},
// `proxy` is run between `before` and `after` `webpack-dev-server` hooks
proxy,
onBeforeSetupMiddleware(devServer) {
// Keep `evalSourceMapMiddleware`
// middlewares before `redirectServedPath` otherwise will not have any effect
// This lets us fetch source contents from webpack for the error overlay
devServer.app.use(evalSourceMapMiddleware(devServer))

if (fs.existsSync(paths.proxySetup)) {
// This registers user provided middleware for proxy reasons
require(paths.proxySetup)(devServer.app)
}
},
onAfterSetupMiddleware(devServer) {
// Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
devServer.app.use(redirectServedPath(paths.publicUrlOrPath))

// 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/facebook/create-react-app/issues/2272#issuecomment-302832432
devServer.app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath))
},
}
}

0 comments on commit 7ade7bd

Please sign in to comment.