-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(env-and-mode): add override rule for the env #6304
Conversation
docs/guide/env-and-mode.md
Outdated
@@ -24,7 +24,7 @@ It will also replace these strings appearing in JavaScript strings and Vue templ | |||
|
|||
## `.env` Files | |||
|
|||
Vite uses [dotenv](https://github.com/motdotla/dotenv) to load additional environment variables from the following files in your [environment directory](/config/#envdir): | |||
Vite uses [dotenv](https://github.com/motdotla/dotenv) to load additional environment variables from the following files in your [environment directory](/config/#envdir) (if define the same variables will override variables in the following reverse order): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it reads hard 🤔
Maybe better something like this? Could even be written better.
Vite uses [dotenv](https://github.com/motdotla/dotenv) to load additional environment variables from the following files in your [environment directory](/config/#envdir) (if define the same variables will override variables in the following reverse order): | |
Vite uses [dotenv](https://github.com/motdotla/dotenv) to load additional environment variables from the following files in your [environment directory](/config/#envdir) (if they define the same variable, the variable defined in the most specific file will win): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think .env.${mode}.local
is in the most specific, but it will be overwrite 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in not the most specific will win?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the most specific currently don't win, then IMO this is a bug and should be changed
And I assume this is what #6306 is fixing 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check https://cli.vuejs.org/guide/mode-and-env.html#environment-variables, see green alert with title Env Loading Priorities
this should be in sync with #6303 , I don't know if the last paragraph added is required, I don't know all vite internals (about restarting)... |
I test it. It need to restart. |
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Description
#6302
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).