-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module becomes undefined
after refresh due to cyclic dependencies
#81
Comments
@sophiebits thanks for this excellent reproduction! I've added a test case for this to the Fast Refresh conformance suite (destined for the |
@Timer I think you're the better judge of that! But it does appear that you successfully copied my code into a test case. 😅 Does the fact that it passes CI mean that this works correctly in @next/react-refresh-utils already? |
@sophiebits Thanks for the reproduction! It seems that the latest version of the plugin also don't have this issue anymore, can you try it out and see if it fixes the issue for you too? I'll further investigate this tonight. |
Sorry, I had tried on the latest stable but not the latest beta. For my mini repro case, I did a bisect and it seems that c66bda1 is the commit that fixed this, though I don't understand why. But for my larger app, it still seems broken on 0.3.0-beta.5. 🙈 Will try to re-reduce when I have time but lmk if you have other ideas. |
It has something to do with whether
I can confirm that if you rename |
I have further investigated the issue and it seems that even without the plugin the issue still persists (given that we don't accept Tbh I'm not sure if we're hitting the limit of Webpack here, it seems to me that the issue only exists when there' both cyclic imports and reexported dependencies. I'll file an issue in Webpack's repository and see what we can do about it. |
Closing as it is marked as |
It would be nice to have a disclaimer in |
I'm experiencing a bug where upon changing a file, one of my modules becomes
undefined
(causing part of the page to disappear).I've mostly reduced my repro case. It seems related to cyclic dependencies. Repro steps:
Clone https://github.com/sophiebits/refresh-cycle-repro
Run
yarn
andyarn start
, then visit http://localhost:7002/. You'll see the text "Hello: 100".If you edit the "Hello" (in App.js), it updates properly.
If you edit the "100" (in SurveyOverview.js), the 100 disappears until next page reload.
This is because the DashboardPage import in routes.js becomes undefined (as you can see from the console logs). If you check the same import a tick later, it is correctly populated.
Not sure whether the bug is in react-refresh-webpack-plugin, react-refresh, or webpack.
The text was updated successfully, but these errors were encountered: