1

Im using Parcel JS to build and bundle my React JS app. I have afew ENV variables being called with process.env.<VARIABLE_NAME>. Locally I have my .env file to store these variables and it's git ignored. I've added these variables in Netlify deploy environment variables settings.

My app works well on local. But when deployed on netlify, the env returns null. what did I miss?

naz
  • 159
  • 1
  • 6
  • Does this answer your question? [Set environment variable for build in Netlify](https://stackoverflow.com/questions/48453493/set-environment-variable-for-build-in-netlify) – azium Nov 16 '19 at 16:21

1 Answers1

0

I had a similar issue with Parcel and it worked by calling my variable name NODE_ENV_<VARIABLE_NAME>

process.env.NODE_ENV_<VARIABLE_NAME>

In Netlify, just <VARIABLE_NAME> works fine for me. Although in React I think instead of NODE_ENV you should call it REACT_APP_<VARIABLE_NAME>.

Hope this works!

Denismr7
  • 559
  • 5
  • 3