-
-
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
HMR broken for React when "@storybook/react": "^6.2.9" present in peer workspace [with reproduction] #6973
Comments
React Fast Refresh often breaks if you have multiple instances of the |
Thanks for the info. That makes sense. Is it possible to identify that and throw a warning? Or is this outside of parcel's scope? |
+1 re: throw a warning. Deck.gl does this if it finds multiple copies of luma.gl. It would be helpful if parcel simply said this:
when you run Even if it does not fix the issue, it will clue a user in as to why HMR is not working as expected. In the case of storybook's react-refresh dependency, I found that this is a simple fix in the top-level package.json
and Storybook still works, despite yarn's warning of an incompatible version. |
Does anyone have a work around for npm as the resolutions trick doesn't work without yarn |
@spence-novata The latest npm (v8.3.0) supports |
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
I've have issues with HMR for React in a monorepo. HMR stops working when "@storybook/react": "^6.2.9" is present in a peer workspace.
Reproduction on main branch
Run
yarn start
from the project root. It should start a dev server that serves thepackages/hero/index.html
site with HMR working but it's not.@dioptre collected #6685 a great list of related prs 🙏. I've gone through them and linked the most relevant below with the corresponding fixes.
Things considered:
🎛 Configuration (.babelrc, package.json, cli command)
🤔 Expected Behavior
Run
yarn start
from the project root. Should start a dev server that serves thepackages/hero/index.html
site with HMR working.HMR should work out of the box for a React project. When the text on in the App.tsx file is edited and saved it should trigger the text content to update in the browser local development server.
😯 Current Behavior
HMR triggered (console.clear() is called) however no change to text or styles
💁 Possible Solution
Fix 1
Fix on fix-hot-reloading-remove-storybook-react branch
The first fix I found was to remove storybook. Looks very similar to the reproduction provided here: #6334
This would suggest that dependency is interfering somewhere in the chain. In yarn, workspace dependencies can hoisted which could have conflicts.
Fix 2:
Fix on fix-hot-reloading-module-hot-accept branch
The second fix is to add
module.hot.accept()
as mentioned in this issue:#6229
🔦 Context
I'm trying to setup a monorepo with parcel in the root building all my packages. Some packages are React apps and some packages are utils and tooling.
💻 Code Sample
Reproduction on main branch fixes on branches
🌍 Your Environment
Notes
Thanks for your work. Let me know if you need help to debug further.
The text was updated successfully, but these errors were encountered: