Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken dotenv? .env not picking up variables #1977

Closed
Geczy opened this issue Apr 12, 2017 · 3 comments
Closed

Broken dotenv? .env not picking up variables #1977

Geczy opened this issue Apr 12, 2017 · 3 comments

Comments

@Geczy
Copy link

Geczy commented Apr 12, 2017

create-react-app tester
cd tester
nano .env
    SITE_NAME=Tester
nano . src/App.js
    {process.env.SITE_NAME}

See attached, both in public/index.html and src/App.js
untitled.zip

@jihchi
Copy link
Contributor

jihchi commented Apr 12, 2017

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. Changing any environment variables will require you to restart the development server if it is running.

ref: https://github.com/facebookincubator/create-react-app/tree/master/packages/react-scripts/template#adding-custom-environment-variables

@Geczy
Copy link
Author

Geczy commented Apr 12, 2017

Oh wow. I didn't see that. I think it should be more explicit than just a "Note" as it's a pretty breaking requirement.

@Geczy Geczy closed this as completed Apr 12, 2017
@gaearon
Copy link
Contributor

gaearon commented Apr 12, 2017

Send a PR to change the user guide? It’s open source 😉

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants