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

.env vars empty in .env.development #11954

Open
pinggi opened this issue Jan 18, 2022 · 0 comments · May be fixed by drich7449/create-react-app#56
Open

.env vars empty in .env.development #11954

pinggi opened this issue Jan 18, 2022 · 0 comments · May be fixed by drich7449/create-react-app#56

Comments

@pinggi
Copy link

pinggi commented Jan 18, 2022

Describe the bug

The environmental variables defined in .env file cannot be used in .env.development and .env.production files.

Steps to reproduce

  1. define .env variable:
PORT=4000
  1. define .env.development variable:
REACT_APP_URL=http://localhost:${PORT}
  1. Add code showing the value
console.log(process.env.REACT_APP_URL);
  1. Run the app and see the value

The result is: "http://localhost:" - the port is missing.

If the port is defined in the same file .env.development:

PORT=4000
REACT_APP_URL=http://localhost:${PORT}

Then the result is correct: "http://localhost:4000".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant