Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #5833
Closed
Open
Issue created Nov 16, 2018 by Administrator@rootContributor

Env var set to empty in shell does not override .env file

Created by: geritol

Is this a bug report?

yes

Environment

System: OS: macOS 10.14 CPU: x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz Binaries: Node: 8.12.0 - /usr/local/bin/node npm: 6.4.1 - /usr/local/bin/npm Browsers: Chrome: 70.0.3538.102 Firefox: 63.0 Safari: 12.0 npmPackages: react: ^16.6.3 => 16.6.3 react-dom: ^16.6.3 => 16.6.3 react-scripts: 2.1.1 => 2.1.1 npmGlobalPackages: create-react-app: Not Found

Steps to Reproduce

(Write your steps here:)

  1. put REACT_APP_VAR=test in .env.production
  2. put console.log("VAR", process.env.REACT_APP_VAR); inApp.js
  3. run REACT_APP_VAR= npm run build
  4. serve the app (serve -s build)

Expected Behavior

The console should containt: VAR

Actual Behavior

The console contains VAR test

Reproducible Demo

https://github.com/geritol/cra-env-repro

Similar to #4002 (closed) but the issue here is that you cannot override with an empty value the vars provided in .env files.

Assignee
Assign to
Time tracking