You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/react-scripts/template/README.md
+19
Original file line number
Diff line number
Diff line change
@@ -978,6 +978,25 @@ Please refer to the [dotenv documentation](https://github.com/motdotla/dotenv) f
978
978
>Note: If you are defining environment variables for development, your CI and/or hosting platform will most likely need
979
979
these defined as well. Consult their documentation how to do this. For example, see the documentation for [Travis CI](https://docs.travis-ci.com/user/environment-variables/) or [Heroku](https://devcenter.heroku.com/articles/config-vars).
980
980
981
+
#### Expanding Environment Variables In `.env`
982
+
983
+
>Note: this feature is available with `react-scripts@1.0.18` and higher.
984
+
985
+
Expand variables already on your machine for use in your .env file (using [dotenv-expand](https://github.com/motdotla/dotenv-expand)). See [#2223](https://github.com/facebookincubator/create-react-app/issues/2223).
986
+
987
+
For example, to get the environment variable `npm_package_version`:
988
+
```
989
+
REACT_APP_VERSION=$npm_package_version
990
+
# also works:
991
+
# REACT_APP_VERSION=${npm_package_version}
992
+
```
993
+
Or expand variables local to the current `.env` file:
994
+
```
995
+
DOMAIN=www.example.com
996
+
REACT_APP_FOO=$DOMAIN/foo
997
+
REACT_APP_BAR=$DOMAIN/bar
998
+
```
999
+
981
1000
## Can I Use Decorators?
982
1001
983
1002
Many popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.<br>
0 commit comments