From 16ab063d2f83934ba8854d1c1fdfdd7016b299b3 Mon Sep 17 00:00:00 2001 From: FoolishChow Date: Mon, 27 Jun 2022 10:31:11 +0800 Subject: [PATCH] #11988 react-native path fix wrong react-native path when project dir contains react-native --- packages/taro-rn-supporter/src/taroResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taro-rn-supporter/src/taroResolver.ts b/packages/taro-rn-supporter/src/taroResolver.ts index 7e33342b18b5..78d330b8a3bc 100644 --- a/packages/taro-rn-supporter/src/taroResolver.ts +++ b/packages/taro-rn-supporter/src/taroResolver.ts @@ -14,7 +14,7 @@ function getReactNativeBasePath (): string { const reactNativeModuleName = 'react-native' const rnBasePath = require.resolve(reactNativeModuleName) const splittings = rnBasePath.split(path.sep) - const index = splittings.indexOf(reactNativeModuleName) + const index = splittings.lastIndexOf(reactNativeModuleName) return splittings.slice(0, index + 1).join(path.sep) }