Currently, I am working on a project where both the front-end and server are located in one directory. I am using a .env file in the root directory, and the structure of the project looks like this:
project frontend (directory) server (directory) .env (file) When I reference process.env.PORT in the server, it works perfectly fine. However, when I try to reference process.env['PORT'] in the front-end, it returns "undefined".
Interestingly, when I start typing my variables, I do get hints for them https://i.sstatic.net/ouNKe.png
However, when I log them, they show up as undefined https://i.sstatic.net/iB4L9.png