Skip to content

"react-scripts-ts build" does not copy environment variables #6333

@zilions

Description

@zilions

I am setting some environment variables in my build script, like so:

"start": "REACT_APP_APPENV=local npm-run-all -p watch-css react-scripts-ts start",
"build": "REACT_APP_APPENV=production npm run build-css && react-scripts-ts build"

My start script works perfectly and I am able to access REACT_APP_APPENV via process.env. REACT_APP_APPENV.

Although my build script does not copy over REACT_APP_APPENV, and process.env. REACT_APP_APPENV is undefined.

I tried creating a fresh new project via npx create-react-app new-app --typescript and the same issue occurred.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions