I'm doing a React project using Vite and I'm having a problem with my .env variable. Currently it is set like this
VITE_API_URL=http://localhost:8080
and I access it using: import.meta.env.VITE_API_URL
But recently, I need to change the value of this variable but I see that the old value is still being used regardless of what I do. I tried resetting the project, computer, using npm cache clean --force and deleting the .vite folder. Any suggestions?
Something with the terminal is caching those .env values, I don't know if that's technically what's going on. But killing the terminal instance and running the process again from a new terminal should bring in the latest values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With