Skip to content

Need peer dep on react-native? #130

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

Closed
erikras opened this issue Sep 29, 2015 · 2 comments
Closed

Need peer dep on react-native? #130

erikras opened this issue Sep 29, 2015 · 2 comments

Comments

@erikras
Copy link
Contributor

erikras commented Sep 29, 2015

How can this line work if there is no mention of react-native in package.json?

import React from 'react-native';

I understand that there is an assumption that if anyone is requireing native.js, that they will already have react-native included in their project deps, but it seems very odd that a library could have an import of a package not mentioned in its package.json.

Am I wrong? I'm trying to understand this mechanism to duplicate it in my own project, and this is confusing me. Could you add a peer dep that didn't cause problems for people just using plain react, or is this just a strangeness of the npm dep system?

@gaearon
Copy link
Contributor

gaearon commented Sep 29, 2015

It wouldn't make sense to force installation of react-native onto people using react, and vice versa. This is why neither is in peerDependencies in package.json.

Yes, we assume the users are already using either of them. I agree it's kinda weird, but it's a better solution than forcing users to install both packages. (Especially considering they might get weird issues when react-native users get react installed side by side.)

This is going to be moot soon after 0.14 is out (and compatible RN release is out) anyway because Component and friends will be inside react package for both platforms, and react-native will become a yet another renderer, just like react-dom. When this happens we'll kill react-redux/native entry point, and everyone will be able to use react-redux directly regardless of the platform. This is when we can introduce a peer dependency.

@gaearon gaearon closed this as completed Sep 29, 2015
@erikras
Copy link
Contributor Author

erikras commented Sep 29, 2015

Got it. Thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants