import.meta.env but undefined in the console #15525
Unanswered
bejanbogdan93
asked this question in
Q&A
Replies: 2 comments
-
Here is an example working: https://stackblitz.com/edit/vitejs-vite-nvdere?file=index.html&terminal=dev When asking this kind of questions, it is a good idea to share a reproduction so others can check it out. Maybe there is a typo somewhere for example? |
Beta Was this translation helpful? Give feedback.
0 replies
-
that's my structure at the moment and my .env constants : Wanted to develop a request without hardcoding URLs, but it seems like the environment variables are not being overridden |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there.
I am trying to get a variable from
.env
file and log it (usingconsole.log()
) but returnsundefined
..env
file is at the root of my project..env
is namedVITE_REACT_APP_SERVER_URL
../src/app/app.jsx
like this:console.log(import.meta.env.VITE_REACT_APP_SERVER_URL);
File structure:
Please point to what I am doing wrong here. Thanks
Beta Was this translation helpful? Give feedback.
All reactions