@apollo/client does not build on Expo React Native iOS

Using ApolloClient as part of a managed Expo React Native project and it works beautifully on web. On iOS, the app does not build because key @apollo/client package files cannot be found. Here is the specific error:

The full error text reads:

iOS Bundling failed 1543ms
While trying to resolve module `@apollo/client` from file `/Users/mng/Documents/code/satchitananda/App.js`, the package `/Users/mng/Documents/code/satchitananda/node_modules/@apollo/client/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/mng/Documents/code/satchitananda/node_modules/@apollo/client/main.cjs`. Indeed, none of these files exist:

  * /Users/mng/Documents/code/satchitananda/node_modules/@apollo/client/main.cjs(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
  * /Users/mng/Documents/code/satchitananda/node_modules/@apollo/client/main.cjs/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)

Any suggestions? Is ApolloClient available for React Native on iOS / Android?

Here are our major package versions:

    "@apollo/client": "^3.5.7",
    "expo": "~43.0.2",
    "graphql": "^16.2.0",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-web": "0.17.1"

running node v14.17.3 and npm 8.1.2

With assistance from Greg Fenton and Cedric at the Expo community Discord, we found a workaround to address this issue with the way Metro bundler includes modules by file extension type.

For full details and code to ensure your React Native ApolloClient code runs on iOS (and, presumably Android) without issue, please see the notice published with version 3.5.4 of the Apollo Client CHANGELOG at: apollo-client/CHANGELOG.md at main · apollographql/apollo-client · GitHub