fix(run): preserve Vite production environment#2048
Open
fengmk2 wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
42d6150 to
cfea874
Compare
cfea874 to
7122a2b
Compare
7122a2b to
0af2693
Compare
Co-authored-by: GPT-5 Codex <codex@openai.com>
0af2693 to
d5dfddf
Compare
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.
Motivation
Running
vp builddirectly defaultsNODE_ENVto"production", but running the same build throughvp run buildorvpr buildreceived JavaScriptnullfrom the Vite Task environment client. Vite assigned that value toprocess.env.NODE_ENV, which Node coerced to"null", producingimport.meta.env.DEV=trueandPROD=falsein production builds.Fixes #2047.
Changes
vp buildwithvp run build.NODE_ENV=testis preserved instead of being replaced with the production default.deploytask whose dependencies includebuildanddb:migrate:prod, matching the follow-up report in vpr build sets NODE_ENV to "null" and produces development import.meta.env values #2047.NODE_ENV="production",DEV=false, andPROD=true.