formidable-landers icon indicating copy to clipboard operation
formidable-landers copied to clipboard

Should React/ReactDOM be peer dependencies?

Open tptee opened this issue 9 years ago • 3 comments

I just ran into a super strange issue where webpack loaded both React 15 and React 0.14, causing all kinds of crazy hell 🔥 Upgrading formidable-landers to v2 should solve my issue, but I can foresee this happening again with the next major React release.

Is there any downside to changing React and ReactDOM to peer dependencies with major version ranges like so?

"peerDependencies": {
  "react": "^0.14.0 || ^15.0.0-0",
  "react-dom": "^0.14.0 || ^15.0.0-0"
}

This way Webpack doesn't assume a hard dependency on specific React versions and doesn't try to load two copies 😄

tptee avatar Jun 07 '16 04:06 tptee

@tptee -- We should be able to override and manually specify resolution behavior. If you have a reproduction, I can help you work through it tomorrow...

ryan-roemer avatar Jun 07 '16 04:06 ryan-roemer

I ran into this issue with loading multiple copies of Radium, and I wondered the same thing!

I am happy to move them both to peerDependencies if that makes the most sense. Let me know how it shakes out.

On Jun 6, 2016, at 21:17, Ryan Roemer [email protected] wrote:

@tptee -- We should be able to override and manually specify resolution behavior. If you have a reproduction, I can help you work through it tomorrow...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

paulathevalley avatar Jun 07 '16 14:06 paulathevalley

@tptee @paulathevalley -- As a head's up, the starting point is using inspectpack with --action=versions which will tell us a lot about why different libs are coming in and from where

If you get a chance, I'd recommend both reading the inspectpack docs and seeing if you can do a custom build for inspect pack and run the analysis. (For your understanding and to dogfood our documentation).

ryan-roemer avatar Jun 07 '16 15:06 ryan-roemer