> npm install
...
> npm ls react
[email protected] /home/brad/Projects/casesandberg/react-color
โโโ [email protected]
โโโฌ [email protected]
โ โโโ [email protected]
โโโฌ [email protected]
โโโ [email protected]
This is a minor issue, but one that we've found can bloat our build size if we're not careful.
Repros on a fresh pull of master at f603122813b82eedfa45f04c86fb7f695c2e9b6f although interactions with external dependencies also influence the repro.
I'm less concerned about react-context because it's listed in devDependencies and therefore only affects development of this package. However, reactcss is listed in dependencies and therefore gets installed by consumers of react-color - thus, consumers of react-color are also installing multiple versions of React at the moment.
The resolution is not a change in this repo, but it seems to impact react-color the most which is why I'm reporting it here. reactcss/master supports React 15 as of https://github.com/casesandberg/reactcss/pull/52, but a new version of the package has not yet been released. Once a new minor/patch version of reactcss is on npm, thanks to the ^0.4.3 rule consumers of react-color will no longer be installing two versions of React.
For anyone interested, here's our temporary workaround by depending on our own fork until updated reactcss gets published.
I was able to solve this issue by switching the OR declaration around in both react-color & reactcss. It's odd, because [email protected] depends on reactcss@^0.4.3 which resolves to 0.4.5.
[email protected] declares react deps in the same way as react-color does, with 0.14 coming first. However, when npm install does it's magic; it ends up changing the dep for reactcss to _just_ ^0.14.0
This seems to work though...
"react": "^15.0.0 || ^0.14.0",
"react-dom": "^15.0.0 || ^0.14.0"
Anyways, I'm tired and sick of this dependency hell, and what seems like an NPM bug. ๐ช
Of course, I have not tested this against an app depending on [email protected], so all bets are off.
Any news on this? reactcss has moved along and is on version 1.0.4 already supporting 0.14 and 15.1 as peerDependencies.
It looks like this is still an issue, as reported a few days ago in https://github.com/casesandberg/react-color/issues/199. I just tried installing react-color 2.2.2 and I end up with multiple versions of React:
โฐโ npm ls react
(my app)
โโโฌ [email protected]
โ โโโ [email protected]
โ โโโฌ [email protected]
โ โโโ [email protected]
It looks like a fix is available in https://github.com/casesandberg/react-color/pull/201 though!
The fix is live [email protected]
Most helpful comment
For anyone interested, here's our temporary workaround by depending on our own fork until updated
reactcssgets published.