Skip to content

.env vars empty in .env.development #11954

Open
drich7449/create-react-app
#56
@pinggi

Description

@pinggi

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".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions