webpack-dev-server: Hot reload module failed : Cannot apply update. Need to do a full reload!
I was trying to debug why the HMR do full page reload everytime …
[HMR] Cannot apply update. Need to do a full reload!
And I tried to look into the module 286 and I don’t know why it is not accepted …
... And I start doing some tracing ... ( Not sure if the following is useful information or not )
I found parent.hot._acceptedDependencies has nothing in it


And my webpack config is very common, and I used the CLI
CLI:
webpack-dev-server --hot --progress --colors --inline --content-base ./docroot
webpack config:
output: {
path: path.join(__dirname, "docroot"),
filename: (IS_PRODUCTION ? "assets/[hash].js" : "assets/bundle.js"),
publicPath: "/"
},
. . .
entry = [
"webpack-dev-server/client?http://localhost:8080",
'./'+APP_ENTRY_POINT
];
Any help will be appreciated, thanks.
According to the documentation – Hot Module Replacement with Inline mode on CLI
Nothing more is needed. --inline --hot does all the relevant work automatically. The CLI of the webpack-dev-server automatically adds the special webpack/hot/dev-server entry point to your configuration. #
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16
Have you tried
https://webpack.github.io/docs/hot-module-replacement-with-webpack.html#what-is-needed-to-use-it
I know more than a few people who have forgotten this, and didn’t know why HMR was not working.
Spent hours to this issue before found that stateless functional components of React 0.14 are not supported.
Please, explain where should we put these 2 lines;
@AriaFallah: if (module.hot) module.hot.accept()
Works for me. Did not notice that on documentation at first.
I’m not immediately certain from the documentation on where exactly to put this code.
@hammeiam https://github.com/AriaFallah/WebpackTutorial/issues/18#issuecomment-187722775
I’m managed to fix the issues I have. Please note that I’m using
vagrant, so it might be different for your case.The following steps are what I changed
(IS_PRODUCTION ? "/" : "http://localhost:8080/")react-hot-loaderwithreact-transform-hmrHope it helps 😃
Webpack has many different ways to set up a project, and some of them conflict. The docs aren’t too clear on exactly what combination of which you should be using when, and using virtual machines or over networks also complicates issues. I have a working simple repo here with hot module reloading:
https://github.com/mummybot/webpack-hmr-network-multiple-entry-points-issue