From 52be51ac881e58d1dad3c0a2e4d31228c42abab1 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Thu, 10 Apr 2025 02:13:41 +0700 Subject: [PATCH] fix(lib/modules/metro): move `nativeModuleProxy` check to specific-export check --- lib/modules/src/metro/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/modules/src/metro/index.ts b/lib/modules/src/metro/index.ts index 1e66f0a..234ab74 100644 --- a/lib/modules/src/metro/index.ts +++ b/lib/modules/src/metro/index.ts @@ -49,7 +49,10 @@ export function isModuleExportBad(exp: Metro.ModuleExports[PropertyKey]) { // Nullish? exp == null || // Is it a proxy? (discord-intl has proxy exports) - isProxy(exp) + isProxy(exp) || + // Can't run isProxy() on this because this isn't your typical proxy: + // https://github.com/discord/react-native/blob/master/packages/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp + exp === nativeModuleProxy ) } @@ -62,10 +65,7 @@ export function isModuleExportsBad(exports: Metro.ModuleExports) { // Nullish? exports == null || // Checking if the object is empty - (exports.__proto__ === Object.prototype && !Reflect.ownKeys(exports).length) || - // Can't run isProxy() on this because this isn't your typical proxy: - // https://github.com/discord/react-native/blob/master/packages/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp - exports === nativeModuleProxy + (exports.__proto__ === Object.prototype && !Reflect.ownKeys(exports).length) ) }