You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was tracking down an issue where process.env.NODE_ENV was being set automatically somehow, and I have tracked it down to calling vite's createServer. This was definitely unexpected! Using a default value make sense, but I would not expect it to set it on process.env
some context - I'm building a config management tool (https://dmno.dev), so anything passed in via env vars are treated as overrides and take precedence over the other config values/resolution rules.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Looking through the commits, this has been discussed in #9274 and the idea is to move automatic NODE_ENV assignment from resolveConfig (or any programatic API surface) to vite CLI level. (but this hasn't been implemented yet or fully agreed yet?)
There isn't a concrete plan, but I'd personally still have the logic in createServer or build instead of just the CLI. Some may also be surprised that the CLI or programmatic API would be inconsistent otherwise, so there isn't a silver bullet here. Perhaps we can document this better if it's unclear from the docs, but I think the behaviour at the moment is intended.
Describe the bug
I was tracking down an issue where
process.env.NODE_ENV
was being set automatically somehow, and I have tracked it down to calling vite'screateServer
. This was definitely unexpected! Using a default value make sense, but I would not expect it to set it onprocess.env
some context - I'm building a config management tool (https://dmno.dev), so anything passed in via env vars are treated as overrides and take precedence over the other config values/resolution rules.
Reproduction
https://stackblitz.com/edit/vitejs-vite-mepepx
Steps to reproduce
npm install
node main.js
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: