invertase / invertase/react-native-apple-authentication

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

Open
#375 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.7k
Forks
236
PR merge metrics
No merged PRs in 30d

Description

## 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/react-native-apple-authentication@2.4.1`
- **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:
```javascript
// 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:
```javascript
// 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.