Skip to content

Commit

Permalink
Merge pull request #11318 from th7nder/t-1127-webpack-dev-server
Browse files Browse the repository at this point in the history
  • Loading branch information
raix authored Aug 19, 2021
2 parents 498c0cf + 45f7db1 commit 5ed5db4
Show file tree
Hide file tree
Showing 6 changed files with 422 additions and 449 deletions.
6 changes: 6 additions & 0 deletions packages/babel-preset-react-app/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ module.exports = function (api, opts, env) {
loose: true,
},
],
[
require('@babel/plugin-proposal-private-property-in-object').default,
{
loose: true,
},
],
// Adds Numeric Separators
require('@babel/plugin-proposal-numeric-separator').default,
// Polyfills the runtime needed for async/await, generators, and friends
Expand Down
833 changes: 401 additions & 432 deletions packages/create-react-app/yarn.lock.cached

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions packages/react-scripts/config/webpackDevServer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,27 +101,27 @@ module.exports = function (proxy, allowedHost) {
},
// `proxy` is run between `before` and `after` `webpack-dev-server` hooks
proxy,
onBeforeSetupMiddleware(app, server) {
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
app.use(evalSourceMapMiddleware(server));
devServer.app.use(evalSourceMapMiddleware(devServer));

if (fs.existsSync(paths.proxySetup)) {
// This registers user provided middleware for proxy reasons
require(paths.proxySetup)(app);
require(paths.proxySetup)(devServer.app);
}
},
onAfterSetupMiddleware(app) {
onAfterSetupMiddleware(devServer) {
// Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
app.use(redirectServedPath(paths.publicUrlOrPath));
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
app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
devServer.app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
},
};
};
2 changes: 1 addition & 1 deletion packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"source-map-loader": "^1.1.2",
"style-loader": "3.0.0",
"webpack": "5.41.1",
"webpack-dev-server": "4.0.0-rc.0",
"webpack-dev-server": "4.0.0",
"webpack-manifest-plugin": "3.1.1",
"workbox-webpack-plugin": "6.2.4"
},
Expand Down
16 changes: 7 additions & 9 deletions packages/react-scripts/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,14 @@ checkBrowsers(paths.appPath, isInteractive)
paths.publicUrlOrPath
);
// Serve webpack assets generated by the compiler over a web server.
const serverConfig = createDevServerConfig(
proxyConfig,
urls.lanUrlForConfig
);
const devServer = new WebpackDevServer(compiler, serverConfig);
const serverConfig = {
...createDevServerConfig(proxyConfig, urls.lanUrlForConfig),
host: HOST,
port,
};
const devServer = new WebpackDevServer(serverConfig, compiler);
// Launch WebpackDevServer.
devServer.listen(port, HOST, err => {
if (err) {
return console.log(err);
}
devServer.startCallback(() => {
if (isInteractive) {
clearConsole();
}
Expand Down
2 changes: 1 addition & 1 deletion tasks/local-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function print_help {

cd $(dirname $0)

node_version=12
node_version=14
current_git_branch=`git rev-parse --abbrev-ref HEAD`
git_branch=${current_git_branch}
test_suite=all
Expand Down

0 comments on commit 5ed5db4

Please sign in to comment.