-
Notifications
You must be signed in to change notification settings - Fork 17
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
Make react-native peerDependency optional #269
Comments
The RFC on yarn package manager which had introduced |
Oh, that’s really interesting! Thanks for your detailed issue, I wasn’t aware of that feature at all. I like the solution you described. |
Closing this request, as The platform independent consumers (like |
Is your feature request related to a problem? Please describe.
When a project depends on
react-native-url-polyfill
and uses npm v7, thereact-native
peerDependency is installed by default. This happens as npm v7 automatically installs peer dependencies.The npm v7 was made generally available on February 2, 2021, and is shipped with latest versions of Node.js
This is a problem, as some packages which depend on
react-native-url-polyfill
may support all JavaScript platforms in a single package. Even if the consumers of those packages do not need support for react-native, the react-native dependency will be installed by default in npm v7.An example is AWS SDK for JavaScript (v3) which supports Node.js, browser and react-native platforms in a single package.
Describe the solution you'd like
Use
peerDependenciesMeta
configuration to set react-native dependency as optional in package.json as follows:The peerDependenciesMeta is supported in:
Describe alternatives you've considered
Setting
react-native-url-polyfill
as optional in projects which consume it.Example in aws-sdk-js-v3 with another polyfill
react-native-get-random-values
aws/aws-sdk-js-v3#2108Additional context
react-native-url-polyfill
in Use react-native-url-polyfill instead of deprecated url.parse in url-parser-native aws/aws-sdk-js-v3#2138react-native-get-random-values
when AWS SDK for JavaScript (v3) is installed using npm v7 Trim production dependencies aws/aws-sdk-js-v3#1536. The request onreact-native-get-random-values
repo Make react-native peerDependency optional LinusU/react-native-get-random-values#27The text was updated successfully, but these errors were encountered: