Hot reloading no longer works after switching back to default WebpackDevServer client
Created by: twig
I had to switch to the default WebpackDevServer client because it allowed me to specify the server address. I've found that doing so breaks the hot reloading functionality completely.
I have another project created by an older version of create-react-app (sorry, can't remember what version) but it's using the same version of webpack-dev-server and configuration and works fine. That's with the same node/npm.
Can you reproduce the problem with latest npm?
I'm currently using the latest node and npm available (node 6.10.0 / npm 3.10.10)
Description
Hot reload does not work with the default webpack-dev-server client
Expected behavior
Hot reload should work with the default webpack-dev-server client.
Actual behavior
There is no websocket connection attempt made to the address specified (http://localhost:3000/), hence hot reload can never be triggered by a code change.
Environment
Run these commands in the project folder and fill in their results:
-
npm ls react-scripts(I've ejected) -
node -v: 6.10.0 -
npm -v: 3.10.10
Then, specify:
- Operating system: Windows 7 x64
- Browser and version: Chromium, Firefox, Vivaldi
Reproducible Demo
Steps to reproduce:
With the latest node/npm/yarn
-
npm install -g create-react-app -
create-react-app hotreload -
cd hotreload -
yarn start -
Test that hot reload works by editing
App.js -
Stop the server
-
yarn eject -
confirm
Y -
yarn start -
Test that hot reload works by editing
App.js -
edit
hotreload/config/webpack.config.dev.js -
find line 43:
require.resolve('react-dev-utils/webpackHotDevClient'), -
comment it out and replace it with
require.resolve('webpack-dev-server/client') + '?http://localhost:3000/', -
yarn start -
Test that hot reload works by editing
App.js -
Hot reload no longer works