TinsFox/shadcnui-boilerplate

.env.* files not working, unable to inject environment variables

Closed this issue · 1 comments

Hi,

I've encountered an issue where my .env.* files are not being loaded correctly in the project. I believe the problem stems from calling dotenv.config() within vite.config.ts file.
I have .env.local files in my project root, containing environment-specific variables prefixed with VITE_.
In vite.config.ts, I noticed it calls dotenv.config() to load the variables. However, this seems to prevent Vite from loading the correct .env.* file based on the active mode.

Yes you are right, dotenv will be removed in the future

But I still recommend using only .env, because when there are multiple .env.*, you need to consider the issue of overwriting