webpack-dev-server: v3.3.0 - HMR stopped working - React Hot Loader
- Operating System: macOS Mojave 10.14.3
- Node Version: 10.14.2
- NPM Version: 6.4.1
- webpack Version: 4.29.6
- webpack-dev-server Version: 3.3.0
- This is a bug
- This is a modification request
Expected Behavior
Hot Module Replacement using react-hot-loader must work.
Actual Behavior
Hot Module Replacement using react-hot-loader broke with webpack-dev-server v3.3.0 but it works if I go back to v3.2.1
For Bugs; How can we reproduce the behavior?
- Clone the repo: https://github.com/shahzaibkhalid/webpack-dev-broken-hmr-example
- Run
yarnto install dependencies - Start the development server by running
yarn start - Check the version of
webpack-dev-serverand downgrade it to v3.2.1, HMR must work now.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (11 by maintainers)
Using
path.resolve(process.cwd(), 'src')is wrong (when you change file, likePlay.jsx, it is causesfsevent -changeso webpack-dev-server reload you page), you needstaticdirectory, notsrc, insrcyou store your source code, instaticyou store static files (usually they copied to dist/build directory)@shahzaibkhalid Why you think it is problem with
react-hot-loader? YoucontentBaseisprocess.cwd()so you watch all changes inprocess.cwd()(includenode_modules), looks somebody write new files innode_modulesand you get refresh