question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
leidegrecommented, Aug 31, 2017

@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…

0reactions
LingYanSicommented, Jul 4, 2022

@mqliutie I have a same problem. when i disable devServer.liveReload,the problem is gone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is module.hot.accept handler not called? - Stack Overflow
Only issue: the module. hot. accept callback is never called, so for hot-replacing my data stores, it does not work.
Read more >
Hot Module Replacement - webpack
Use Cases. Conditional Accepting. A module can accept a dependency, but can call invalidate when the change of the dependency is not handleable:...
Read more >
Webpack — Hot Module Replacement - Medium
Now whenever webpack detects a change in any of the modules, it looks for the module.hot.accept() function in the parent of that module....
Read more >
devServer & Hot Module Replacement (Live Reload) - YouTube
Let's learn about webpack, live-reloading, Hot Module Replacement, creating NPM scripts and more.0:00 Intro1:02 Getting Started15:39 ...
Read more >
A Deep Dive into Hot Module Replacement with Webpack ...
The self-accept causes webpack to execute the module whenever a hot update is needed. src/lights.js function turnOn() { ... setInterval(() => ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found