From 5b165838cecc539b2cb9cef256cdf78f31ab841b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20B=C3=BCrger?= Date: Mon, 18 Jul 2022 20:51:05 +0200 Subject: [PATCH] Move cocoapods cli native_modules require from template to rn scripts This resolves issues where the node_modules structure is not hoisted (like with pnpm). Since the template does not directly depend on the cli, it doesn't exist in the pnpm node_modules root. Moving it to the rn scripts makes sure that the relative require starts in the correct directory for both hoisted and pnpm structures. --- package.json | 1 + scripts/native_modules.rb | 6 ++++++ template/ios/Podfile | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 scripts/native_modules.rb diff --git a/package.json b/package.json index eaba0ca0d854be..47d6ffdbe277a5 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "scripts/xcode/with-environment.sh", "scripts/launchPackager.bat", "scripts/launchPackager.command", + "scripts/native_modules.rb", "scripts/node-binary.sh", "scripts/packager.sh", "scripts/packager-reporter.js", diff --git a/scripts/native_modules.rb b/scripts/native_modules.rb new file mode 100644 index 00000000000000..729035ddd91d71 --- /dev/null +++ b/scripts/native_modules.rb @@ -0,0 +1,6 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +require_relative '../../@react-native-community/cli-platform-ios/native_modules' diff --git a/template/ios/Podfile b/template/ios/Podfile index 92e7ee1919e671..594b74dc56f576 100644 --- a/template/ios/Podfile +++ b/template/ios/Podfile @@ -1,5 +1,5 @@ require_relative '../node_modules/react-native/scripts/react_native_pods' -require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' +require_relative '../node_modules/react-native/scripts/native_modules' platform :ios, '12.4' install! 'cocoapods', :deterministic_uuids => false