`react` in deprecated `peerDependencies` causes conflicts for consumers
ranweiler opened this issue · comments
Hi! It looks like react
got moved into peerDependencies
in 0.5.0. The latest version fixes the reactify
issue (thanks!), but I think the use of peerDependencies
is causing issues with multiple versions of react
being loaded in a consumer that also depends upon react
. This results in runtime conflicts that cryptically manifest like this: http://stackoverflow.com/questions/27153166/typeerror-when-using-react-cannot-read-property-firstchild-of-undefined
This appears to be a result of the fact that peerDependencies
for a given package are installed. react
seems to fall into the class of modules discussed in the "Singletons" section of this comment: npm/npm#5080 (comment).
For context, I am consuming react-draggable2
via the material-ui
package (which needs to update its dependency to ^0.5.0, from ^0.4.3). Using 0.4.3 of react-draggable
breaks my Browserify-based bundling. I can work around that by manually updating the dependency to 0.5.0. This breaks e.g. my testing due to the new use of peerDependencies
in 0.5.0. My workaround for that is just to delete the new copy of react
that gets installed as a sibling of react-draggable2
(due to the peer dependency). Then everything works as expected!
I think just moving react
back into devDependencies
would fix this.
Thanks @ranweiler !