Skip to content

fix(iOS): use the module name when rewriting module map paths of spm_dependency pods - #59182

Open
mfazekas wants to merge 1 commit into
react:mainfrom
mfazekas:fix-spm-modulemap-module-name
Open

mfazekas wants to merge 1 commit into
react:mainfrom
mfazekas:fix-spm-modulemap-module-name

Conversation

@mfazekas

Copy link
Copy Markdown
Contributor

Summary:

Since #57602, a static pod that declares spm_dependency is built into the shared products dir, and rewrite_aggregate_modulemap_references rewrites the aggregate -fmodule-map-file flags from <Pod>/<Pod>.modulemap to <Pod>.modulemap. CocoaPods names the module map after the pod's module, though (${PODS_CONFIGURATION_BUILD_DIR}/<label>/<product_module_name>.modulemap), and the module name differs from the pod name whenever the pod name isn't a C identifier. For @rnmapbox/maps (pod rnmapbox-maps, module rnmapbox_maps) the flag keeps pointing at rnmapbox-maps/rnmapbox_maps.modulemap, which no longer exists, and the app fails to build on 0.87, 0.88 and current nightlies:

error: module map file '${PODS_CONFIGURATION_BUILD_DIR}/rnmapbox-maps/rnmapbox_maps.modulemap' not found

This takes the module name from the aggregate target's pod targets instead of assuming it equals the pod name.

Changelog:

[IOS] [FIXED] - Fix "module map file not found" for spm_dependency pods whose module name differs from the pod name

Test Plan:

  1. Added test_module_map_references_use_the_module_name_of_pods_built_into_the_shared_products_dir to scripts/cocoapods/__tests__/spm-test.rb. It fails before the change (the rnmapbox-maps/rnmapbox_maps.modulemap reference is left as is) and passes after; ruby spm-test.rb: 9 tests, 25 assertions, 0 failures.
  2. Created an app with react-native@0.89.0-nightly-20261018-27e77216e and @rnmapbox/maps with its Swift Package Manager opt-in ($RNMapboxMapsSwiftPackageManager = true). Before: pod install writes -fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/rnmapbox-maps/rnmapbox_maps.modulemap" into Pods-App.debug.xcconfig and the build fails with the error above. After applying this patch to the app's node_modules/react-native: the flag is ${PODS_CONFIGURATION_BUILD_DIR}/rnmapbox_maps.modulemap and the Debug build succeeds. With the equivalent path rewrite applied on the library side, the app also launches on the simulator and shows the map, and a Release archive succeeds.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 19, 2026
@mfazekas
mfazekas marked this pull request as ready for review October 19, 2026 09:37
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant