Extra vars do not show up in EAS build

Something I’ve been playing with to make the transition easier is to create a layer that switches between the old and the new manifest system, depending on what is available. The reason why this matters to us is that some programmers on the team are still using Expo Go somehow.

Here is how:

I created a file config.ts that has the following:

import Constants from "expo-constants"

// eslint-disable-next-line
let config

if (Constants.manifest) {
  config = Constants.manifest.extra // The old manifest
} else {
  config = Constants.manifest2.extra.expoClient.extra // The new manifest
}

export default config

Now elsewhere in the code, where previously I used

import Constants from "expo-constants"
const { someVariable } = Constants.manifest.extra

Now I use

import config from "../config" // path to that new config.ts file
const { debugSentry, env, sentryDsn } = config
...

However this solution is still incomplete due to complications with how eas secrets / eas update work – I created a post here detailing this aspect: Are EAS Secrets available to EAS Updates