Custom Environment Variable Prefix (Instead if `REACT_APP_`)
See original GitHub issueAt my company, we have standard environment variable naming conventions. create-react-app
s hard-coded default - REACT_APP_
does not adhere to these. It would be nice to be able to configure these by either:
- Supplying config in
package.json
or - Passing a flag to the
react-scripts
command - Setting another environment variable? (perhaps too meta)
(1) and (2) would also allow running multiple create-react-app
projects with global environment variables as well (as opposed to using the .env
files)
Are others running into this?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:24 (9 by maintainers)
Top Results From Across the Web
Why Do We Need REACT_APP Prefix in .env File for React ...
As mentioned in the docs, a React app will include the environment variables in the source code when you build the application.
Read more >Adding Custom Environment Variables | Create React App
Your project can consume variables declared in your environment as if they were declared locally in your JS files.
Read more >Using environment variables in a React application
In this article we'll see how to use environment variables in a React application. Specifically, we'll look at two kinds of environments variables:....
Read more >React environment variables: A developer's guide - Architect.io
A hands-on guide for managing environment variables in your React app, including best practices and common mistakes.
Read more >Managing Environment Variables in React (create-react-app)
For all custom environment variables in apps created via create-react-app , we need to use REACT_APP_ prefix in env var names - it's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s not too bad to do without ejecting.
I think it would be nice to have something like array
appEnvVars
inpackage.json
. Only these variables along withNODE_ENV
andPUBLIC_URL
will be passed to the application.