-
Notifications
You must be signed in to change notification settings - Fork 904
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
Fix resolving node modules directory with custom exports #1655
Fix resolving node modules directory with custom exports #1655
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I decided to vendor the implementation of pickValues
and findPackageDependencyDir
due to the @rnx-kit/tools-node
package adding roughly 42kB: https://packagephobia.com/result?p=%40rnx-kit%2Ftools-node. RN CLI already downloads a lot of stuff and we need to make a better job at keeping it lean so that npx react-native init
speed is good enough.
* Fix resolving node modules directory with custom exports * vendor rnx-kit helpers to reduce node_modules size Co-authored-by: Michał Pierzchała <[email protected]>
Summary: Bumping main to latest version of CLI available; in particular, we want to ensure to propagate this fix react-native-community/cli#1655. After merging, we'll cherry-pick in the `0.70-stable` branch. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General] [Changed] - bump CLI to v9.0.0-alpha.5 Pull Request resolved: #34275 Test Plan: CI Reviewed By: NickGerleman Differential Revision: D38151383 Pulled By: dmitryrykun fbshipit-source-id: afdafb496a159ad766dd322a4aab4bda6146edf0
Summary: Bumping main to latest version of CLI available; in particular, we want to ensure to propagate this fix react-native-community/cli#1655. After merging, we'll cherry-pick in the `0.70-stable` branch. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General] [Changed] - bump CLI to v9.0.0-alpha.5 Pull Request resolved: #34275 Test Plan: CI Reviewed By: NickGerleman Differential Revision: D38151383 Pulled By: dmitryrykun fbshipit-source-id: afdafb496a159ad766dd322a4aab4bda6146edf0 # Conflicts: # yarn.lock
Summary: Bumping main to latest version of CLI available; in particular, we want to ensure to propagate this fix react-native-community/cli#1655. After merging, we'll cherry-pick in the `0.70-stable` branch. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General] [Changed] - bump CLI to v9.0.0-alpha.5 Pull Request resolved: facebook#34275 Test Plan: CI Reviewed By: NickGerleman Differential Revision: D38151383 Pulled By: dmitryrykun fbshipit-source-id: afdafb496a159ad766dd322a4aab4bda6146edf0
Summary: Bumping main to latest version of CLI available; in particular, we want to ensure to propagate this fix react-native-community/cli#1655. After merging, we'll cherry-pick in the `0.70-stable` branch. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General] [Changed] - bump CLI to v9.0.0-alpha.5 Pull Request resolved: facebook#34275 Test Plan: CI Reviewed By: NickGerleman Differential Revision: D38151383 Pulled By: dmitryrykun fbshipit-source-id: afdafb496a159ad766dd322a4aab4bda6146edf0
i did but it doesnt work. omg |
Summary:
Fixes #1168
As described in the issue, it's currently not possible to use RN CLI with packages that have
exports
in theirpackage.json
and do not containpackage.json
itself in theexports
object. For example,d3
dependency does just that. While maintainers could make their package compatible with the RN CLI, such an effort would be huge and not all maintainers want to do that – understandably so, especially if their packages are not exclusively for RN.To fix this, I've imported this method from the
@rnx-kit/tools-node
package that does not depend on therequire.resolve
method (which currently does not work in the case described above). Alternatively, we could just import the method itself but the package is quite small, so in this case, it's probably better in the long run to depend on it instead.Test Plan:
yarn
yarn start
yarn start
again