You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/env-and-mode.md
+2
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,8 @@ Vite uses [dotenv](https://github.com/motdotla/dotenv) to load additional enviro
29
29
30
30
An env file for a specific mode (e.g. `.env.production`) will take higher priority than a generic one (e.g. `.env`).
31
31
32
+
Vite will always load `.env` and `.env.local` in addition to the mode-specific `.env.[mode]` file. Variables declared in mode-specific files will take precedence over those in generic files, but variables defined only in `.env` or `.env.local` will still be available in the environment.
33
+
32
34
In addition, environment variables that already exist when Vite is executed have the highest priority and will not be overwritten by `.env` files. For example, when running `VITE_SOME_KEY=123 vite build`.
33
35
34
36
`.env` files are loaded at the start of Vite. Restart the server after making changes.
0 commit comments