Skip to content

fix(run): preserve Vite production environment#2048

Open
fengmk2 wants to merge 1 commit into
mainfrom
fix/vp-run-node-env
Open

fix(run): preserve Vite production environment#2048
fengmk2 wants to merge 1 commit into
mainfrom
fix/vp-run-node-env

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jul 4, 2026

Copy link
Copy Markdown
Member

Motivation

Running vp build directly defaults NODE_ENV to "production", but running the same build through vp run build or vpr build received JavaScript null from the Vite Task environment client. Vite assigned that value to process.env.NODE_ENV, which Node coerced to "null", producing import.meta.env.DEV=true and PROD=false in production builds.

Fixes #2047.

Changes

@netlify

netlify Bot commented Jul 4, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit d5dfddf
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a49308fb03c620008d36ae1

@fengmk2 fengmk2 force-pushed the fix/vp-run-node-env branch 2 times, most recently from 42d6150 to cfea874 Compare July 4, 2026 15:08
@fengmk2 fengmk2 marked this pull request as ready for review July 4, 2026 15:09
@fengmk2 fengmk2 requested a review from wan9chi July 4, 2026 15:09
@fengmk2 fengmk2 force-pushed the fix/vp-run-node-env branch from cfea874 to 7122a2b Compare July 4, 2026 15:41
@fengmk2 fengmk2 marked this pull request as draft July 4, 2026 15:41
@fengmk2 fengmk2 marked this pull request as ready for review July 4, 2026 15:46
@fengmk2 fengmk2 force-pushed the fix/vp-run-node-env branch from 7122a2b to 0af2693 Compare July 4, 2026 16:07
Co-authored-by: GPT-5 Codex <codex@openai.com>
@fengmk2 fengmk2 force-pushed the fix/vp-run-node-env branch from 0af2693 to d5dfddf Compare July 4, 2026 16:10
@fengmk2 fengmk2 self-assigned this Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vpr build sets NODE_ENV to "null" and produces development import.meta.env values

1 participant