diff --git a/packages/react-native/Libraries/TurboModule/TurboModuleRegistry.js b/packages/react-native/Libraries/TurboModule/TurboModuleRegistry.js index a069106ff29..e52cd1abdee 100644 --- a/packages/react-native/Libraries/TurboModule/TurboModuleRegistry.js +++ b/packages/react-native/Libraries/TurboModule/TurboModuleRegistry.js @@ -30,8 +30,9 @@ function isTurboModuleInteropEnabled() { return global.RN$TurboInterop === true; } -function shouldReportLoadedModules() { - return isTurboModuleInteropEnabled(); +// TODO(154308585): Remove "module not found" debug info logging +function shouldReportDebugInfo() { + return true; } // TODO(148943970): Consider reversing the lookup here: @@ -41,7 +42,7 @@ function requireModule(name: string): ?T { // Backward compatibility layer during migration. const legacyModule = NativeModules[name]; if (legacyModule != null) { - if (shouldReportLoadedModules()) { + if (shouldReportDebugInfo()) { moduleLoadHistory.NativeModules.push(name); } return ((legacyModule: $FlowFixMe): T); @@ -51,17 +52,16 @@ function requireModule(name: string): ?T { if (turboModuleProxy != null) { const module: ?T = turboModuleProxy(name); if (module != null) { - if (shouldReportLoadedModules()) { + if (shouldReportDebugInfo()) { moduleLoadHistory.TurboModules.push(name); } return module; } } - if (shouldReportLoadedModules()) { + if (shouldReportDebugInfo()) { moduleLoadHistory.NotFound.push(name); } - return null; } @@ -75,7 +75,12 @@ export function getEnforcing(name: string): T { `TurboModuleRegistry.getEnforcing(...): '${name}' could not be found. ` + 'Verify that a module by this name is registered in the native binary.'; - if (shouldReportLoadedModules()) { + if (shouldReportDebugInfo()) { + message += 'Bridgeless mode: ' + (isBridgeless() ? 'true' : 'false') + '. '; + message += + 'TurboModule interop: ' + + (isTurboModuleInteropEnabled() ? 'true' : 'false') + + '. '; message += 'Modules loaded: ' + JSON.stringify(moduleLoadHistory); }