-
Notifications
You must be signed in to change notification settings - Fork 939
Description
This is a meta issue to keep track of the things that need to be tweaked to give RN-CLI support for Yarn Plug 'n Play. This is probably non-exhaustive, more things might be found as others are tweaked.
-
Global CLI: Support for finding
react-nativeandreact-native-local-cliwhen PnP is enabled (in progress: Add (very basic) Yarn Plug 'n Play support #26 ) -
react-native bundle: Support for bundling dependencies with PnP. (Metro team is working on open sourcing its PnP support: Support for resolving Yarn Plug 'n Play modules facebook/metro#308) -
findPlugins: Plugin discovery code will need to be adapted to support PnP -
Xcode
pbxprojfiles all have paths hardcoded in like this:path = "../node_modules/react-native/React/React.xcodeproj";There is, as far as I know, no way to have this path be dynamic. Ideally there would be some kind of way to have Xcode call a subprocess (like
node resolve-dependency.jsor something) and use it as the path's prefix, but I don't think there's a way. So I think a script might need to be made to refresh these paths and keep them up to date.This is also relevant for user libraries and
react-native linkfor iOS dependencies -
Gradle scripts will need to be updated along with
react-native link's Gradle output. Here's an example bit out output forreact-native-webview:project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
The path to it is hardcoded to look in
node_modules. I think a new helper function could be written, that would look something like:npm_dependency('react-native-webview', 'android')Where the first argument is the name of the node module, and the second is a pathname within the node_module. If PnP isn't present, then it will simply output an old-style path to
node_modules. A similar function could be made for BUCK. -
Paths to
node_modules/react-nativeare hardcoded in these files and will need to be updated. They could all useutil/findReactNativePath, potentially.-
local-cli/library/library.js -
local-cli/eject/eject.js -
local-cli/generator/templates.js -
local-cli/link/__tests__/ios/getHeaderSearchPath.spec.js -
local-cli/upgrade/upgrade.js -
local-cli/util/findReactNativeScripts.js
-