mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-05-01 02:42:39 +08:00
clarifying the use of custom environment variables (#1513)
* clarifying the use of custom environment variables * Tweak
This commit is contained in:
committed by
Dan Abramov
parent
de6e0590b2
commit
160d8d13ef
@@ -515,7 +515,11 @@ To learn more about Flow, check out [its documentation](https://flowtype.org/).
|
||||
|
||||
Your project can consume variables declared in your environment as if they were declared locally in your JS files. By
|
||||
default you will have `NODE_ENV` defined for you, and any other environment variables starting with
|
||||
`REACT_APP_`. These environment variables will be defined for you on `process.env`. For example, having an environment
|
||||
`REACT_APP_`.
|
||||
|
||||
>Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid accidentally [exposing a private key on the machine that could have the same name](https://github.com/facebookincubator/create-react-app/issues/865#issuecomment-252199527).
|
||||
|
||||
These environment variables will be defined for you on `process.env`. For example, having an environment
|
||||
variable named `REACT_APP_SECRET_CODE` will be exposed in your JS as `process.env.REACT_APP_SECRET_CODE`, in addition
|
||||
to `process.env.NODE_ENV`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user