variable not set - returning undefined #124
Comments
Sorry, I'm not sure what's up, that should work... |
Thanks for the quick reply |
I would start by going into your node_modules directory and adding console.log statements throughout the cross-env code |
Just did what you mentioned... Actually - I just tried logging any kind to environment variable, and all return undefined. TEMP, windir etc, the all returned undefined. I have a react app which is being run by webpack. Am I not understanding something correctly? Please let me know |
Oh, no, you wont find environment variables available in your client-side bundle. Only in node. If you want to expose environment variables in the client, then you can either use this babel plugin or webpack's define plugin. You'll want to do that in addition to using I'll close this issue because I'm 99% sure that's the problem. Good luck! |
Awesome! Works perfectly! David |
Hi there
I am trying to get this to work but I am not being successful
I have tried several commands, the simplest of which is:
And when I
console.log(process.env.NODE_ENV)
, I getundefined
.What I originally wanted to do was the following:
But I thought that maybe it was a problem with run-p (which is part of
npm-run-all
package), so I tried the simpler version that I posted above, but no matter what I try, I getundefined
.What am I doing wrong?
Thanks,
David
The text was updated successfully, but these errors were encountered: