Skip to content

InlineConfig.envFile is deprecated but no runtime warning is emitted #22547

Closed

Description

@n-satoshi061

Description

InlineConfig.envFile is marked as @deprecated in 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 }.

Affected version

vite@8.0.14 and current main branch.

Affected file

packages/vite/src/node/config.ts

The type definition carries the deprecation annotation (L637–638):

/** @deprecated */
envFile?: false

But the usage site silently converts it without any warning (L1677–1678):

// Backward compatibility: set envDir to false when envFile is false
let envDir = config.envFile === false ? false : config.envDir

Inconsistency with other deprecated options

Other deprecated options in the same file emit a logger.warn() when used:

Deprecated option Runtime warning
esbuild → oxc ✅ logger.warn() (L1875, L1885)
optimizeDeps.esbuildOptions → rolldownOptions ✅ logger.warn() (L1207)
optimizeDeps.rollupOptions → rolldownOptions ✅ rollupOptionsDeprecationCall()
InlineConfig.envFile: false ❌ no warning

Additionally, the migration guide (docs/guide/migration.md) documents esbuild and esbuildOptions deprecations in detail, but has no entry for envFile: false → envDir: false.

Background

InlineConfig.envFile?: false was added in #2475 for the programmatic API. It was deprecated in #19503 (merged 2025-03-31), which introduced envDir: false as the recommended replacement. The deprecation annotation was added as a side-effect of that PR; no runtime warning was included.

Proposed direction and open question

The straightforward fix would be to add a logger.warn() call when config.envFile === false is detected, consistent with how other deprecated options are handled:

// load .env files
if (config.envFile === false) {
  logger.warn(
    colors.yellow(
      '`envFile: false` is deprecated. Use `envDir: false` instead.',
    ),
  )
}
let envDir = config.envFile === false ? false : config.envDir

However, InlineConfig is the programmatic API used by framework integrations such as Astro, Nuxt, and SvelteKit. If any of these currently pass { envFile: false } to createServer() or build(), adding this warning would surface in end-user output without those frameworks having made any change.

Would this direction be acceptable? If so, I'd also propose adding a short migration note to docs/guide/migration.md. Happy to submit a PR once the approach is confirmed.

Activity

  1. truffle-dev commented on May 30, 2026

    @truffle-dev
  2. n-satoshi061 commented on May 31, 2026

    @n-satoshi061
    Author

    @truffle-dev Thanks for the thorough investigation — this is exactly the kind of concrete data that makes the sequencing decision easier.

    For reference, PR #22555 has already been opened taking approach (2): it adds the runtime warning directly without prior coordination with React Router. Given that React Router's usage is intentional (not migration debt), I'd like to hear from the maintainers on whether they prefer (1) — coordinate with React Router first — before that PR is merged.

    @patak-dev Would you be able to weigh in on the preferred sequencing here?

  3. added a commit that references this issue on Jun 1, 2026
    69e95e2
  4. locked and limited conversation to collaborators on Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions