diff --git a/packages/react-native/React/Base/RCTBundleURLProvider.mm b/packages/react-native/React/Base/RCTBundleURLProvider.mm index 596706da3bec73..d5aa66b9963b64 100644 --- a/packages/react-native/React/Base/RCTBundleURLProvider.mm +++ b/packages/react-native/React/Base/RCTBundleURLProvider.mm @@ -12,6 +12,8 @@ #import "RCTDefines.h" #import "RCTLog.h" +#import + NSString *const RCTBundleURLProviderUpdatedNotification = @"RCTBundleURLProviderUpdatedNotification"; const NSUInteger kRCTBundleURLProviderDefaultPort = RCT_METRO_PORT; @@ -281,6 +283,12 @@ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot [[NSURLQueryItem alloc] initWithName:@"modulesOnly" value:modulesOnly ? @"true" : @"false"], [[NSURLQueryItem alloc] initWithName:@"runModule" value:runModule ? @"true" : @"false"], ]; + auto &inspectorFlags = facebook::react::jsinspector_modern::InspectorFlags::getInstance(); + if (inspectorFlags.getEnableModernCDPRegistry()) { + queryItems = [queryItems arrayByAddingObject:[[NSURLQueryItem alloc] initWithName:@"excludeSource" value:@"true"]]; + queryItems = [queryItems arrayByAddingObject:[[NSURLQueryItem alloc] initWithName:@"sourcePaths" + value:@"url-server"]]; + } NSString *bundleID = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleIdentifierKey]; if (bundleID) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java index cecd41074c15ee..09b9b2bace5fc8 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java @@ -382,17 +382,20 @@ private String createBundleURL( String mainModuleID, BundleType type, String host, boolean modulesOnly, boolean runModule) { boolean dev = getDevMode(); return String.format( - Locale.US, - "http://%s/%s.%s?platform=android&dev=%s&lazy=%s&minify=%s&app=%s&modulesOnly=%s&runModule=%s", - host, - mainModuleID, - type.typeID(), - dev, // dev - dev, // lazy - getJSMinifyMode(), - mPackageName, - modulesOnly ? "true" : "false", - runModule ? "true" : "false"); + Locale.US, + "http://%s/%s.%s?platform=android&dev=%s&lazy=%s&minify=%s&app=%s&modulesOnly=%s&runModule=%s", + host, + mainModuleID, + type.typeID(), + dev, // dev + dev, // lazy + getJSMinifyMode(), + mPackageName, + modulesOnly ? "true" : "false", + runModule ? "true" : "false") + + (InspectorFlags.getEnableModernCDPRegistry() + ? "&excludeSource=true&sourcePaths=url-server" + : ""); } private String createBundleURL(String mainModuleID, BundleType type) {