From f0d2b29f4f6fb630784ec0a74084cd9839621866 Mon Sep 17 00:00:00 2001
From: Rick nagual <singloo.yang@gmail.com>
Date: Wed, 5 Apr 2023 15:38:25 +0800
Subject: [PATCH] fix(react-native): add `aliasFields` to handle replaced files
 in browser env

closed #16105
---
 packages/react-native/plugins/metro-resolver.ts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/packages/react-native/plugins/metro-resolver.ts b/packages/react-native/plugins/metro-resolver.ts
index 4b1fab107d06cc..74153d2404f291 100644
--- a/packages/react-native/plugins/metro-resolver.ts
+++ b/packages/react-native/plugins/metro-resolver.ts
@@ -205,6 +205,7 @@ function getPnpmResolver(extensions: string[]) {
       modules: [join(workspaceRoot, 'node_modules'), 'node_modules'],
       conditionNames: ['native', 'browser', 'require', 'default'],
       mainFields: ['react-native', 'browser', 'main'],
+      aliasFields: ['browser'],
     });
   }
   return resolver;