-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
React Fast Refresh doesn't work in a monorepo folder structure #7798
Comments
I had a similar problem and creating a separate frontend only package.json and launching from the a separate frontend CWD solved the problem. In my case I believe this was due to babel plugins and other settings interfering with parcel. To further investigate your issue it would be very helpful if you could upload a sample repo demonstrating the problem. |
I've created a reproduction here: https://github.com/lilyannh/parcel-issue-7853 |
This is resolved by making sure that parcel is a dependency of each package and not a dependency of the project itself. |
I'm having the same issue in my monorepo. Unfortunately it's not open sourced(contracted). I do have parcel installed only in the package with the react app. |
welp, i found the culprit. i had to run @lilyannh try running |
This worked for me, I have a browser extension in one directory and a Next.js website in another. Next.js was using React refresh 0.8.3 and the browser extension (which uses Parcel) was on 0.9.0 so I updated Next.js and it works like a charm now! Thanks @BlackFenix2 you saved my thousands of F5 presses! |
@BlackFenix2 same situation of having Storybook in a monorepo, I just forced a resolution of "resolutions": {
"**/react-refresh": "^0"
} |
No I only have one version of react-refresh in my project :( |
I believe I've tracked down a root cause here (at least, for one version of this scenario that seems to match the above). TL;DR for people trying to work around this
Root causeReact's Fast Refresh is implemented across two Parcel plugins -- The key problem here is that This is easy to have bite you if you have some other transitive dependency. In my case it came from The fix?TBH I'm not sure what the right approach is here. The core issue is having Maybe having some intermediary wrapping library over |
@shz Thank you!! This issue has been driving me crazy and it was very difficult to find the root cause. For me, the issue wasn't even different versions of the module, it was the fact that an identical version was not de-duped. See the following dep tree: $ npm ls react-refresh
[email protected]
└─┬ [email protected]
└─┬ @parcel/[email protected]
├─┬ @parcel/[email protected]
│ └── [email protected]
└─┬ @parcel/[email protected]
└── [email protected] Workaroundnpm dedupe react-refresh Running the above resulted in the following dependency tree and fixed react-refresh for me: [email protected]
└─┬ [email protected]
└─┬ @parcel/[email protected]
├─┬ @parcel/[email protected]
│ └── [email protected]
└─┬ @parcel/[email protected]
└── [email protected] deduped Maybe @parcel/runtime-react-refresh should list |
I'm also working on a monorepo and if I want to see the changes that I made to the code reflected on the browser I need to stop the dev server, delete
edit: I did some digging and it works fine with |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
🐛 bug report
Fast refresh changes don't apply when making code changes
🎛 Configuration
My folder structure is as follows:
😯 Current Behavior
Websocket sees the update come in, the console clears, but the page doesn't actually update.
💁 Possible Solution
When I move the src folder from my test to the root, HMR works as expected.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: