When using an env variable VITE_COLOR to change the color of a theme importing a different CSS file depending on that variable, the behavior seem to be correct during development, but not after build.
### Additional context
_No response_
### Validations
- [X] Check if you're on the [latest VitePress version](https://github.com/vuejs/vitepress/releases/latest).
- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)
- [X] Read the [docs](https://vitepress.dev).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Describe the bug
When using an env variable
VITE_COLOR
to change the color of a theme importing a different CSS file depending on that variable, the behavior seem to be correct during development, but not after build.Reproduction
Minimal reproducible example:
https://github.com/Peque/vitepress-color-change
The repository has two commits:
VITE_COLOR
variable.Development works as expected:
VITE_COLOR=red npm run docs:dev
-> Red colorVITE_COLOR=blue npm run docs:dev
-> Blue colorBuilds do not work as expected when opening
http-serve
:VITE_COLOR=red npm run docs:build
-> Red colorVITE_COLOR=blue npm run docs:build
-> Red colorExpected behavior
Development works as expected:
VITE_COLOR=red npm run docs:dev
-> Red colorVITE_COLOR=blue npm run docs:dev
-> Blue colorBuilds do not work as expected when opening
http-serve
:VITE_COLOR=red npm run docs:build
-> Red colorVITE_COLOR=blue npm run docs:build
-> Blue colorSystem Info