Expo EAS Build Error: Redefinition of module ‘ReactCommon’ during iOS Build

I’m having a problem building my project after recently upgrading to the new Expo version. When I run the :

eas build --platform iOS

I get an error in Fastlane. Here is the content of the error below.
On the previous version of Expo, everything worked perfectly.

Project Setup:
• Expo SDK: 51.0.20
• React Native: 0.74.3
• Expo CLI
• EAS CLI

Error Message:

(ios/Pods/Headers/Public/ReactCommon/ReactCommon.modulemap:1:8)

> 1 | module ReactCommon {
    |        ^ redefinition of module 'ReactCommon'
  2 |   umbrella header "ReactCommon-umbrella.h"
  3 |   exclude header "React-RuntimeApple-umbrella.h"
  4 | 
› Compiling react-native Pods/React-RCTAppDelegate » RCTRootViewFactory.mm
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » verseapp/verseapp » Build Phases » '[CP-User] [RNFB] Core Configuration'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸   CompileC /Users/expo/Library/Developer/Xcode/DerivedData/verseapp-frukfgckrzhanffhpufsuiextprw/Build/Intermediates.noindex/ArchiveIntermediates/verseapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/React-RCTAppDelegate.build/Objects-normal/arm64/React-RCTAppDelegate-dummy.o /Users/expo/workingdir/build/ios/Pods/Target Support Files/React-RCTAppDelegate/React-RCTAppDelegate-dummy.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-RCTAppDelegate' from project 'Pods')
▸ (1 failure)
** ARCHIVE FAILED **
The following build commands failed:
    CompileC /Users/expo/Library/Developer/Xcode/DerivedData/verseapp-frukfgckrzhanffhpufsuiextprw/Build/Intermediates.noindex/ArchiveIntermediates/verseapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/React-RCTAppDelegate.build/Objects-normal/arm64/React-RCTAppDelegate-dummy.o /Users/expo/workingdir/build/ios/Pods/Target Support Files/React-RCTAppDelegate/React-RCTAppDelegate-dummy.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-RCTAppDelegate' from project 'Pods')
(1 failure)

eas.json

{
  "cli": {
    "version": ">= 7.1.3",
    "appVersionSource": "remote"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "channel": "development"
    },
    "preview": {
      "distribution": "internal",
      "channel": "preview"
    },
    "production": {
      "channel": "production",
      "autoIncrement": true
    }
  },
  "submit": {
    "production": {}
  }
}

app.json

{
  "expo": {
    "name": "verseapp",
    "slug": "verseapp",
    "version": "1.4.1",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "light",
    "notification": {
      "icon": "./assets/notification-icon.png",
      "color": "#D39E54"
    },
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#D39E54"
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "bitcode": false,
      "infoPlist": {
        "NSCameraUsageDescription": "This app uses the camera to take photos and videos."
      },
      "supportsTablet": true,
      "icon": "./assets/icon.png",
      "bundleIdentifier": "com.verseapp.verseapp"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#D39E54",
        "googleServicesFile": "./google-services.json"
      },
      "package": "com.verseapp.verseapp"
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "plugins": [
      "expo-font",
      "./withModularHeadersPlugin",
      [
        "expo-notifications",
        {
          "icon": "./assets/notification-icon.png",
          "color": "#D39E54"
        }
      ],
      [
        "expo-build-properties",
        {
          "android": {
            "compileSdkVersion": 34,
            "targetSdkVersion": 34,
            "buildToolsVersion": "34.0.0"
          },
          "ios": {
            "deploymentTarget": "13.4"
          }
        }
      ]
    ],
    "extra": {
      "eas": {
        "projectId": "a7525463-2f90-4252-8d74-e078......."
      }
    },
    "runtimeVersion": {
      "policy": "appVersion"
    },
    "updates": {
      "url": "https://u.expo.dev/a7525463-2f90-4252-8d74-e078b....."
    }
  }
}

Custom Plugin:

withModularHeadersPlugin.js

const { createRunOncePlugin, withDangerousMod } = require("@expo/config-plugins");
const fs = require("fs");
const path = require("path");

const withModularHeaders = (config) => {
  return withDangerousMod(config, [
    "ios",
    async (config) => {
      // Path to the iOS directory
      const iosDir = config.modRequest.platformProjectRoot;
      const podfilePath = path.join(iosDir, "Podfile");
      let podfileContents = fs.readFileSync(podfilePath, "utf8");

      // Ensure use_modular_headers! is at the top
      if (!podfileContents.includes("use_modular_headers!")) {
        podfileContents = `use_modular_headers!n${podfileContents}`;
      }

      // Modify FirebaseCoreInternal
      podfileContents = podfileContents.replace(
        "pod 'FirebaseCoreInternal'",
        "pod 'FirebaseCoreInternal', :modular_headers => true"
      );

      // Modify ReactCommon
      podfileContents = podfileContents.replace(
        /pod 'ReactCommon',s*:[^,]+, :modular_headers => true/,
        `pod 'ReactCommon', :path => "#{node_modules_path}/ReactCommon", :modular_headers => false`
      );

      // Write the modified contents back to the Podfile
      fs.writeFileSync(podfilePath, podfileContents);
      return config;
    },
  ]);
};

module.exports = createRunOncePlugin(
  withModularHeaders,
  "withModularHeaders",
  "1.0.0"
);

I have tried the following approaches to resolve this issue:

1.  Adding use_modular_headers! to the Podfile.
2.  Setting :modular_headers => false for ReactCommon.
3.  Using a custom Expo Config Plugin to modify the Podfile.

Despite these efforts, the error persists. Any guidance or suggestions to resolve this issue would be greatly appreciated. Thank you!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật