Closed natew closed 9 years ago
React 0.13 is out so, there should be a better way to do this now.
Making React a peerDependency
stops it from being installed in the package itself. This is a misunderstanding of how package.json
and peerDependencies
works.
The solution is to be more lenient with the required version; I'll bump it.
But if I understand correctly you wouldn't use react-tappable by itself, you'd import it into another project and use it there. In a sense it's like a plugin in that you wouldn't want a React sub-dependency.
At least that's how I've used it.
You would, but it stands alone as well for examples, build, etc.
Using both peerDependencies
and devDependencies
together would probably solve the problem, but there are other issues with peerDependencies
as well. Making the dependency version >=0.12.0
also fixes the issue, with less side effects.
One of the side effects is that if React is a peerDependency
then npm link
will always break. react-tappable
will never be able to resolve require("react")
.
Having said that, npm link
will also cause the double-react issue 100% of the time; I haven't figured out a good way around that yet :(
Hmm. I don't run tests on a lot of stuff I link in, so maybe I never ran into it. The double react issue is frustrating, I have explicit instructions on avoiding that in some repos.
React-router uses both as well, maybe they have something working better.
Actually, looks like react-router does devDependencies
and peerDependencies
, which may be what does it.
Couple tweaks here. Peer dependency so it doesn't duplicate react version, and also adding support for the beta version.
But... not sure why but running an
npm link
with this package.json is giving me this: