react-native: Hot Reloading `Maximum call stack size exceeded` error with circular reference

Say, there are two files a.js and b.js.

a.js:

require('./b');

b.js:

require('./a')

After change one of this file, with Hot Reloading enabled, it will run into an infinite situation and cause Maximum call stack size exceeded finally.

Even if I use a dynamic require in a function, such as what in b.js:

function f(){
  require('./a')
}

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 19
  • Comments: 24 (8 by maintainers)

Most upvoted comments

This issue is still happening as of 0.48.0. This should be opened again

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we’re automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

+1, on Android

Adding module.hot.accept(() => { }); to one of the files in the circular reference fixes the error but excludes that file from hot reloading.

Hey folks! This has been recently fixed and it will be available in v0.54.0