react-native-apple-authentication icon indicating copy to clipboard operation
react-native-apple-authentication copied to clipboard

AppleButton module resolution fails in EAS Build due to missing AppleButton.js file

Open canberkvarli opened this issue 5 months ago • 2 comments

Description

The @invertase/react-native-apple-authentication package exports AppleButton from ./AppleButton in its index.js file, but the AppleButton.js file doesn't exist in the package. This causes build failures in EAS Build environments.

Error Message

Unable to resolve module ./AppleButton from /Users/expo/workingdir/build/node_modules/@invertase/react-native-apple-authentication/lib/index.js: 
None of these files exist:
  * node_modules/@invertase/react-native-apple-authentication/lib/AppleButton(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.mjs|.mjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)
  * node_modules/@invertase/react-native-apple-authentication/lib/AppleButton
  22 |
  23 |
> 24 | export { default as AppleButton } from './AppleButton';
     |                                         ^
  25 |
  26 | /**
  27 |  * iOS

Expected Behavior

The package should either:

  1. Include the missing AppleButton.js file, or
  2. Not export AppleButton if it's not available

Actual Behavior

The package tries to export AppleButton from a non-existent file, causing Metro bundler to fail during the build process.

Environment

  • Package Version: @invertase/[email protected]
  • Platform: iOS (EAS Build)
  • Build Environment: EAS Build (Expo Application Services)
  • Metro Version: Latest (via Expo SDK 52)

Investigation

The package contains platform-specific AppleButton files:

  • AppleButton.ios.js
  • AppleButton.android.js
  • AppleButton.macos.js
  • AppleButton.shared.js

But it's missing the generic AppleButton.js file that the main index.js tries to import.

Suggested Fix

The package should either:

  1. Option A: Create a generic AppleButton.js file that exports the appropriate platform-specific component:

    // AppleButton.js
    import { Platform } from 'react-native';
    
    const AppleButton = Platform.select({
      ios: require('./AppleButton.ios.js').default,
      android: require('./AppleButton.android.js').default,
      macos: require('./AppleButton.macos.js').default,
      default: require('./AppleButton.shared.js').default,
    });
    
    export default AppleButton;
    
  2. Option B: Remove the AppleButton export from the main index.js if it's not meant to be used:

    // Comment out or remove this line from index.js
    // export { default as AppleButton } from './AppleButton';
    

Impact

This issue affects any project using this package in EAS Build environments, even if they're not using the AppleButton component (only using appleAuth).

Additional Context

  • The issue only occurs in EAS Build, not in local development
  • Projects that only use appleAuth (not AppleButton) are still affected
  • Looking for help with a proper solution

canberkvarli avatar Sep 12 '25 01:09 canberkvarli