Babel-preset-react-app not getting environment variables

Failed to compile. /src/index.js Module build error: Error: Usage babel-preset-react-app

required to specify NODE_ENV

or BABEL_ENV

environment variables. Valid values ​​are development, test, and production. Instead I got: "undefined". (While processing is Pre-installed: "C: \ Users \ Mitch \ OneDrive \ Development \ Git \ react seeds \ node_modules \ pandemonium-pre-installed react app \ index.js") on Array.map (native)

I keep getting the above error no matter how many weird and wonderful ways I try to set either an environment variable or an environment variable starting from updating my react app and even getting it from a new app created from "create-react" - app '- What am I clearly doing wrong?

+3


source to share


1 answer


I do this in my package. json:



{
  "scripts": {
    "build": "NODE_ENV=development babel src -d lib",
    "build-prod": "NODE_ENV=production babel src -d lib"
  }
}

      

+4


source







All Articles