@@ -443,6 +443,26 @@ jobs:
443443 yarn workspace @selfxyz/mobile-app run build:deps --silent || { echo "❌ Dependency build failed"; exit 1; }
444444 echo "✅ Dependencies built successfully"
445445
446+ - name : Configure Metro for Production Bundle (iOS)
447+ if : inputs.platform != 'android'
448+ run : |
449+ echo "⚙️ Configuring Metro bundler for production lazy loading compatibility..."
450+ cd ${{ env.APP_PATH }}
451+ # Create production-specific metro config to fix lazy loading issues
452+ cp metro.config.cjs metro.config.ci.cjs
453+ # Disable inlineRequires to prevent lazy loading issues with Hermes
454+ sed -i '' 's/inlineRequires: true,/inlineRequires: false,/' metro.config.ci.cjs
455+ # Verify the change was applied
456+ if grep -q "inlineRequires: false" metro.config.ci.cjs; then
457+ echo "✅ inlineRequires disabled in CI config"
458+ else
459+ echo "❌ Failed to disable inlineRequires"
460+ exit 1
461+ fi
462+ # Update Hermes flags to ensure proper optimization without breaking lazy imports
463+ echo "export METRO_CONFIG_PATH=./metro.config.ci.cjs" >> $GITHUB_ENV
464+ echo "✅ Metro configuration updated for CI"
465+
446466 # act won't work with macos, but you can test with `bundle exec fastlane ios ...`
447467 - name : Build and upload to App Store Connect/TestFlight
448468 if : inputs.platform != 'android' && !env.ACT
@@ -463,6 +483,7 @@ jobs:
463483 IOS_TEAM_ID : ${{ secrets.IOS_TEAM_ID }}
464484 IOS_TEAM_NAME : ${{ secrets.IOS_TEAM_NAME }}
465485 NODE_OPTIONS : " --max-old-space-size=8192"
486+ RN_BUNDLE_CONFIG : " ./metro.config.ci.cjs"
466487 SLACK_API_TOKEN : ${{ secrets.SLACK_API_TOKEN }}
467488 SLACK_CHANNEL_ID : ${{ secrets.SLACK_CHANNEL_ID }}
468489 SLACK_ANNOUNCE_CHANNEL_NAME : ${{ secrets.SLACK_ANNOUNCE_CHANNEL_NAME }}
@@ -489,13 +510,17 @@ jobs:
489510
490511 if [ "$TEST_MODE" = "true" ]; then
491512 echo "🧪 Running in TEST MODE - will skip upload to TestFlight"
513+ # Set Metro config path for React Native bundle generation
514+ export METRO_CONFIG_PATH="./metro.config.ci.cjs"
492515 bundle exec fastlane ios deploy_auto \
493516 deployment_track:$DEPLOYMENT_TRACK \
494517 version_bump:$VERSION_BUMP \
495518 test_mode:true \
496519 --verbose
497520 else
498521 echo "🚀 Deploying to App Store Connect..."
522+ # Set Metro config path for React Native bundle generation
523+ export METRO_CONFIG_PATH="./metro.config.ci.cjs"
499524 bundle exec fastlane ios deploy_auto \
500525 deployment_track:$DEPLOYMENT_TRACK \
501526 version_bump:$VERSION_BUMP \
@@ -846,6 +871,26 @@ jobs:
846871 yarn workspace @selfxyz/mobile-app run build:deps --silent || { echo "❌ Dependency build failed"; exit 1; }
847872 echo "✅ Dependencies built successfully"
848873
874+ - name : Configure Metro for Production Bundle (Android)
875+ if : inputs.platform != 'ios'
876+ run : |
877+ echo "⚙️ Configuring Metro bundler for production lazy loading compatibility..."
878+ cd ${{ env.APP_PATH }}
879+ # Create production-specific metro config to fix lazy loading issues
880+ cp metro.config.cjs metro.config.ci.cjs
881+ # Disable inlineRequires to prevent lazy loading issues with Hermes
882+ sed -i 's/inlineRequires: true,/inlineRequires: false,/' metro.config.ci.cjs
883+ # Verify the change was applied
884+ if grep -q "inlineRequires: false" metro.config.ci.cjs; then
885+ echo "✅ inlineRequires disabled in CI config"
886+ else
887+ echo "❌ Failed to disable inlineRequires"
888+ exit 1
889+ fi
890+ # Update Hermes flags to ensure proper optimization without breaking lazy imports
891+ echo "export METRO_CONFIG_PATH=./metro.config.ci.cjs" >> $GITHUB_ENV
892+ echo "✅ Metro configuration updated for CI"
893+
849894 - name : Build AAB with Fastlane
850895 if : inputs.platform != 'ios'
851896 env :
@@ -856,6 +901,7 @@ jobs:
856901 ANDROID_KEY_PASSWORD : ${{ secrets.ANDROID_KEY_PASSWORD }}
857902 ANDROID_PACKAGE_NAME : ${{ secrets.ANDROID_PACKAGE_NAME }}
858903 NODE_OPTIONS : " --max-old-space-size=8192"
904+ RN_BUNDLE_CONFIG : " ./metro.config.ci.cjs"
859905 run : |
860906 cd ${{ env.APP_PATH }}
861907
@@ -870,6 +916,8 @@ jobs:
870916 echo " - Test Mode: $TEST_MODE"
871917
872918 echo "🔨 Building AAB with Fastlane..."
919+ # Set Metro config path for React Native bundle generation
920+ export METRO_CONFIG_PATH="./metro.config.ci.cjs"
873921 bundle exec fastlane android build_only \
874922 deployment_track:$DEPLOYMENT_TRACK \
875923 version_bump:$VERSION_BUMP \
0 commit comments