Not able to load .env variables from the root directory into the react project built using Vite
So, the problem I am facing is that I have front-end code in the frontend folder and .env file in the root folder. When I try to import the env variables into the folder from the root directory it does not work but when I try the same thing by moving the .env folder into the frontend dir it works fine. I have read on the web that this is something to do with vite.config.js file and tried everything and gets the same error everytime. Below is the error I get:
[GSI_LOGGER]: The given client ID is not found
I am getting “GSI_LOGGER]: The given client ID is not found.” as the error in my console. and also my key shows in the console with the way I log it in my main.jsx and hardcoded way. but not working with import.meta.env.VITE_PUBLIC_GOOGLE_CLIENT_ID