Skip to content

vite 3.2 ignores env variables from cli #10676

@rrittwag

Description

@rrittwag

Describe the bug

Env variables that are defined in a cli call (e.g. VITE_TITLE='title from cli' vite) are ignored since Vite 3.2.0.

Reproduction

https://stackblitz.com/edit/vitejs-vite-rr4qtt?file=package.json

Steps to reproduce

  • use an env variable in vite (e.g. VITE_TITLE)
  • define or override it via cli call (e.g. in package.json)

Expected behaviour: the env variable is defined/overriden by cli - as it is common in most cli tools.

Current behaviour: Since Vite v3.2.0 the cli env variables are ignored.

System Info

System:
    OS: macOS 13.0
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 599.27 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.11.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.2 - /usr/local/bin/npm
  Browsers:
    Chrome: 106.0.5249.119
    Firefox: 106.0.2
    Safari: 16.1
  npmPackages:
    vite: 3.2.0 => 3.2.0

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p4-importantViolate documented behavior or significantly improves performance (priority)regressionThe issue only appears after a new release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions