diff --git a/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec b/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec index d354b40c0..9b3c11767 100644 --- a/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec +++ b/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec @@ -1,7 +1,6 @@ require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) -folly_compiler_flags = '-DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' Pod::Spec.new do |s| s.name = "DatadogSDKReactNativeSessionReplay" @@ -49,17 +48,22 @@ Pod::Spec.new do |s| } if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then - s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1" + s.compiler_flags = "-DRCT_NEW_ARCH_ENABLED=1" xcconfig.merge!({ "DEFINES_MODULE" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }) - end - s.pod_target_xcconfig = xcconfig + s.pod_target_xcconfig = xcconfig - if respond_to?(:install_modules_dependencies, true) - install_modules_dependencies(s) + # install_modules_dependencies is only available on RN >= 0.71 + if respond_to?(:install_modules_dependencies, true) + install_modules_dependencies(s) + else + Pod::UI.warn "Using Datadog React Native Session Replay with new architecture on RN < 0.71 is discouraged and not officially supported." + end + else + s.pod_target_xcconfig = xcconfig end end diff --git a/packages/react-native-session-replay/src/metro/index.ts b/packages/react-native-session-replay/src/metro/index.ts index b61a3abc5..c4f30a2e2 100644 --- a/packages/react-native-session-replay/src/metro/index.ts +++ b/packages/react-native-session-replay/src/metro/index.ts @@ -11,7 +11,7 @@ import path from 'path'; import { mergeSvgAssets } from './processing'; import { debounce } from './utils'; -let watching = false; +let watcher: ReturnType | null = null; const MERGE_DEBOUNCE_MS = 300; const WATCH_STABILITY_THRESHOLD_MS = 200; @@ -38,9 +38,8 @@ export function withSessionReplayAssetBundler(metroConfig: any): any { }, MERGE_DEBOUNCE_MS); // Prevent potential multiple watchers if metro loads the config multiple times - if (!watching) { - watching = true; - chokidar + if (!watcher) { + watcher = chokidar .watch(assetsDir, { // Skip events for files that already exist ignoreInitial: true, @@ -75,6 +74,14 @@ export function withSessionReplayAssetBundler(metroConfig: any): any { event.type === 'transformer_load_done' ) { mergeSvgAssets(assetsDir); + + // Close the file watcher after bundling completes + // This prevents the chokidar watcher from keeping the + // Node process alive during release/CI builds + if (watcher) { + watcher.close(); + watcher = null; + } } } }