webpack: `module.hot.accept(..., () => ...)` is never called

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

The following modules couldn’t be hot updated… the only thing that appears to work is if I list no deps, i.e. module.hot.accept() but that breaks rendering in my case, can’t just rerun the file.

I have dep chain like this.

main -> requires/imports -> routes routes -> requires/imports -> pages/index pages/index -> requires/imports -> pages/Home

Home is changed (React and hot loader is used):

In main there’s a module.hot.accept('./routes', () => ...)

However, get warning The following modules couldn't be hot updated

And it’s referring to pages/Home but it should have been handled through routes because that’s how it arrived in main

If the current behavior is a bug, please provide the steps to reproduce.

Not generally reproducible.

What is the expected behavior?

That module.hot.accept get’s called and that the module is hot updated.

If this is a feature request, what is motivation or use case for changing the behavior?

Countless hours wasted here trying to get it to work without any guide on how to improve the situation. I would like to put together a guide for troubleshooting these issues, something indepth and technical enough so that you can work your way through the problem, right now, I’m just lost with insufficent information from webpack, I have built two identical setups, one works there other doesn’t but there’s nothing there to help me sort out why, I know this probably is a mistake nested somewhere in my setup but I cannot find it, I’ve spent the better part of 3 days trying to chase this down and it’s not the first time I spend a lot of time trying to understand why HMR isn’t working. So, I would really appricate some help trying to root cause this and improving the situation for the future.

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

Latest version of webpack. 3.5.5

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 18 (7 by maintainers)

Most upvoted comments

@sokra anything special about the code you linked or would it be possible to just slap that in your “main” function for debugging purposes? What is this check() API?

NVM found it here https://webpack.js.org/api/hot-module-replacement/

I will figure something out…