Skip to content

fix(plugin): resolve config APIs through Expo - #1341

Open
huytdps13400 wants to merge 1 commit into
dotintent:masterfrom
huytdps13400:fix/1339-expo-config-plugin-resolution
Open

fix(plugin): resolve config APIs through Expo#1341
huytdps13400 wants to merge 1 commit into
dotintent:masterfrom
huytdps13400:fix/1339-expo-config-plugin-resolution

Conversation

@huytdps13400

Copy link
Copy Markdown

Summary

  • import config plugin APIs from the Expo package re-export instead of undeclared @expo/config-plugins
  • declare Expo 51+ as an optional peer and use Expo 51 for development so bare React Native consumers are unaffected
  • add a plugin-resolution regression and run plugin tests in CI
  • update the existing plugin test to exercise the same public Expo re-export

This follows Expo library-plugin guidance: importing through expo/config-plugins uses the version owned by the consuming app and avoids relying on hoisting under pnpm or Yarn PnP.

Guidance: https://docs.expo.dev/config-plugins/development-and-debugging/#import-the-config-plugins-package

TDD evidence

RED: the plugin test environment could not resolve expo/config before Expo was declared, matching the missing-package class from the issue. The regression also makes any remaining direct @expo/config-plugins import throw while the Expo re-export is available.

GREEN: 2 plugin suites / 7 tests pass and the plugin loads through the re-export with the direct package blocked.

Verification

  • Node 18.20.8 / Yarn 1.22.22 repository environment
  • yarn clean:plugin && yarn build:plugin
  • yarn test:plugin --runInBand — 2 suites / 7 tests passed
  • yarn lint — passed (4 existing no-explicit-any warnings in examples)
  • yarn typecheck — passed after the same example-first install sequence as CI
  • yarn prepack — Bob commonjs/module/typescript builds passed
  • ESLint and Prettier checks for changed plugin/JSON files passed
  • packed artifact contains only expo/config-plugins imports
  • Node 20.20.2 / pnpm 10 strict consumer with expo@56.0.20: expo config --json --full passed and emitted BLUETOOTH, BLUETOOTH_ADMIN, and BLUETOOTH_CONNECT permissions
  • workflow YAML parses successfully
  • git diff --check passed

Repository note: yarn test:package currently fails on unchanged master and this branch because the current Babel parser cannot parse React Native 0.77 mapped Flow syntax in EventEmitter.js. This patch does not touch that test/tooling path.

Fixes #1339

Use the app's Expo re-export instead of relying on a hoisted @expo/config-plugins package, and declare Expo as an optional peer so strict package-manager layouts can evaluate the plugin.
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.

🐛 After upgrading an Expo app to SDK 56, Expo config evaluation fails when using the react-native-ble-plx config plugin.

1 participant