Skip to content

fix: add AppleButton.js so Expo Metro can resolve the export (#375) - #394

Open
cpruijsen wants to merge 2 commits into
invertase:mainfrom
cpruijsen:fix/issue-375
Open

cpruijsen wants to merge 2 commits into
invertase:mainfrom
cpruijsen:fix/issue-375

Conversation

@cpruijsen

Copy link
Copy Markdown

Fixes #375
Fixes #364

Why

lib/index.js always does export { default as AppleButton } from './AppleButton', but the published package only shipped AppleButton.ios.js / .android.js / .macos.js (and AppleButton.shared.js constants). There was no generic AppleButton.js. Expo SDK 52 Metro (EAS, including the expo export:embed server pass) resolves that specifier with web/generic source extensions and never tries .ios.js, so the app fails to bundle even when it only uses appleAuth.

Reporter listed the missing file and the exact Metro candidate list on #375. The same error is #364 (iOS Bundled succeeded, then the server/web pass failed). A commenter confirmed a Platform.select + require() workaround against node_modules.

How

Add lib/AppleButton.js as the platform-agnostic module those sourceExts look for. It Platform.selects the existing iOS / Android / macOS implementations, with the Android JS button as default.

index.js is unchanged. When Metro still applies platform suffixes, native iOS/Android/macOS keep using the existing platform files.

Decision

  • Chose: new AppleButton.js fallback with Platform.select.
  • Alternative: put Platform.select in index.js (the patch on AppleButton module resolution fails in EAS Build due to missing AppleButton.js file #375), or re-export AppleButton.android.js with no select (same shape as AppleButton.macos.js).
  • Why: a generic file is the React Native fallback Metro expects; Platform.select keeps the native iOS button if Expo loads the generic file on iOS. default is the Android JS button, not AppleButton.shared.js, that file is constants only and has no default export, so the snippet in the issue would have set AppleButton to undefined.
  • Happy to switch to either alternative if that is preferred.

Test plan

@CLAassistant

CLAassistant commented Sep 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

2 participants