Skip to content

fix(expo): preserve config plugin resolution in packed builds - #4347

Closed
RobJacobson wants to merge 2 commits into
rnmapbox:mainfrom
RobJacobson:codex/fix-expo-plugin-resolution
Closed

RobJacobson wants to merge 2 commits into
rnmapbox:mainfrom
RobJacobson:codex/fix-expo-plugin-resolution

Conversation

@RobJacobson

Copy link
Copy Markdown
Contributor

Description

Addresses config-plugin discovery failures reported in #4147 and #4286.

Bob’s generated lib/module/package.json causes the legacy Expo resolver to search for app.plugin.js inside that directory. It misses the root plugin and loads the React Native runtime entry, which fails in Node.

Disable Bob’s strict ESM packaging metadata while retaining module output and Metro’s native/web selection. Add regression coverage against freshly built npm archives using both legacy and current Expo resolvers, plus Metro resolution for compiled and source entries.

Also exclude generated lib/ output from the general source type check. Copied native specs were resolving type imports against adjacent JavaScript with erased types.

Depends on #4346. This branch currently includes its type-export commit, which the packed declaration-consumer checks build on.

Reproduction and regression results

Run yarn jest __tests__/packageResolution.test.js --runInBand.

Check Before After
Packed-package resolution suite 1 failed, 8 passed 9 passed
Legacy Expo plugin discovery ERR_MODULE_NOT_FOUND for lib/module/Mapbox Loads root app.plugin.js; registers Android/iOS mods
Metro iOS, Android and web resolution All 6 cases passed All 6 cases passed
General type check after building 51 errors in generated lib/ files No errors

Current Expo plugin discovery and the explicit app.plugin.js export pass before and after.

Validation

  • yarn build — passed.
  • yarn type:check after the fresh build — passed.
  • yarn test — lint passed with warnings; 27 suites and 182 tests passed, including packed declaration-consumer checks.
  • git diff --check — passed.

Native and web verification covers module resolution. Device runtime behavior was not exercised; #4286’s separate “module undefined” report remains unconfirmed.

Checklist

  • Read CONTRIBUTING.md and .github/REPRODUCING.md.
  • Reproduced the packaging failure before fixing it.
  • Verified the same reproducer after the fix.
  • Code generation: not applicable; no component or style changes.

- Restore the four reported source type imports through explicit declaration exports
- Expose expression, style, symbol layer, map payload, and press event types publicly
- Verify built and packed outputs with generated package metadata and dependency types
- Cover private internal paths and Node runtime export rejection
- Disable Bob's strict ESM packaging metadata so legacy Expo resolvers find the root config plugin
- Exercise legacy and current Expo plugin loaders and native/web Metro resolution against fresh npm archives
- Share packed-artifact fixtures with the published type-export regression suite
- Exclude generated library output from the general source type check

@mfazekas mfazekas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for digging into the resolver mechanism. The failure comes from Expo Tools still pinning @expo/config-plugins 4.1.5 (the current Expo CLI resolves our app.plugin.js fine), so I think the fix belongs in Expo Tools. I don't see much benefit in turning off bob's esm output, which is the create-react-native-library default, just to accommodate an outdated tool. Also, this branch carries #4346's type-export changes; those should stay in that PR.

@mfazekas

Copy link
Copy Markdown
Contributor

Closing this, sorry. We'd rather keep bob's esm output and see the plugin resolution fixed in Expo Tools. Thanks again for tracking down the mechanism.

@mfazekas mfazekas closed this Oct 13, 2026
@RobJacobson
RobJacobson deleted the codex/fix-expo-plugin-resolution branch October 14, 2026 00:09

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants