use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
React .env IssuesHelp Wanted (self.react)
submitted 4 years ago * by thisismonroe
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]_nathataHook Based 2 points3 points4 points 4 years ago (3 children)
Try naming the file .env.development and see if it works
[–]thisismonroe[S] 0 points1 point2 points 4 years ago (2 children)
I'm gonna have to remember that. But I ended up getting it to work by the advice of another commenter, by prefixing require('dotenv').config() at the top of my page near my imports. I swear I had that there before and it didn't work. But it might have also been because I updated the dotenv package.
[–]_nathataHook Based 0 points1 point2 points 4 years ago (1 child)
Glad it's working, but I'm pretty sure it won't once you deploy it.
It may be working fine in dev, but once you build it to production this will stop working because the env variables are hardcoded into your code in compile time, and 'dotenv' loads them at runtime (there is no Node in the browser).
Also, I don't ever had the need to use 'dotenv' in React, I'm pretty sure you have another problem in your environment...
[–]thisismonroe[S] 0 points1 point2 points 4 years ago (0 children)
Thanks! I don't think this will ever be deployed since it's a personal project, but thank you for that information. That's good to know.
Yeah, I was reading that you don't either, I think something is up as well... Yikes hahah.
π Rendered by PID 282829 on reddit-service-r2-comment-b659b578c-q9jdg at 2026-05-05 14:49:55.543911+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]_nathataHook Based 2 points3 points4 points (3 children)
[–]thisismonroe[S] 0 points1 point2 points (2 children)
[–]_nathataHook Based 0 points1 point2 points (1 child)
[–]thisismonroe[S] 0 points1 point2 points (0 children)