fix: add deprecation warning for config.envFile#22569
Closed
godfengliang wants to merge 1 commit into
Closed
Conversation
Fixes vitejs#22547 `config.envFile` is marked as `@deprecated` in the TypeScript definition but no runtime warning was emitted when users used it. This adds a `logger.warn()` call to guide users to migrate to `config.envDir`.
bluwy
reviewed
Jun 6, 2026
Comment on lines
+1679
to
+1682
| logger.warn( | ||
| 'config.envFile is deprecated. Use config.envDir instead. ' + | ||
| 'For example, replace { envFile: false } with { envDir: false }.', | ||
| ) |
Member
There was a problem hiding this comment.
We usually use colors.yellow, and we can also shorten this following the other warning patterns:
Suggested change
| logger.warn( | |
| 'config.envFile is deprecated. Use config.envDir instead. ' + | |
| 'For example, replace { envFile: false } with { envDir: false }.', | |
| ) | |
| logger.warn( | |
| colors.yellow( | |
| 'The `envFile` option is deprecated, please use `envDir: false` instead. ', | |
| ), | |
| ) |
Might need to be formatted
Member
|
closing as it seems #22555 was merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #22547
InlineConfig.envFileis marked as@deprecatedin the TypeScript definition, but no runtime deprecation warning is emitted when it is used. This means users calling the programmatic API with{ envFile: false }receive no guidance to migrate to{ envDir: false }.What This PR Does
Adds a
logger.warn()call inpackages/vite/src/node/config.ts(L1678-1683) that emits a deprecation warning whenconfig.envFile === falseis used:This follows the existing pattern used by other deprecation/warning messages in the same file (e.g., L1696, L1497).
How to Test
{ envFile: false }Before this fix: No warning is emitted.
After this fix: A clear migration guide is shown to the user.