[Feature Request] - Public env variables loading customization option
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 696
- Avg merge
- 8m
- Merged PRs (30d)
- 7
Description
Do you want to request a feature or report a bug?
Request a feature
What is the current behavior?
Currently, environment variables are loaded according to the docs (Environment variables in Expo), which is working just fine, but it cannot be customized.
What is the expected behavior?
It would be nice to have the possibility to customize which env variables get loaded into the app, without needing to use the EXPO_PUBLIC_ prefix.
Our use case is that we have a monorepo with multiple projects (FE Web, FE Mobile, BE Node, etc.) and there is a centralized approach to environment variables handling. So, we have managed to apply out custom approach to all projects, but not the EXPO ones.
As an example, Storybook supports the following approach:
const config = {
/*
* 👇 The `config` argument contains all the other existing environment variables.
* Either configured in an `.env` file or configured on the command line.
*/
env: (config) => ({
...config,
EXAMPLE_VAR: 'A custom environment variable'
})
};
Our final goal is not only to achieve consistency in environment variables naming across projects, but some variables can only be calculated during the build/start process, depending on the context.
Thanks for your time!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files, tests, or entry points are named in the issue. Start by locating Metro's existing environment-variable loading path and reviewing the linked Expo and Storybook approaches; define which configuration surface should select variables and verify that customized variables are available during the app build/start process.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100