Skip to content

fix(client): return undefined for missing env values#507

Closed
fengmk2 wants to merge 1 commit into
mainfrom
fix/get-env-undefined
Closed

fix(client): return undefined for missing env values#507
fengmk2 wants to merge 1 commit into
mainfrom
fix/get-env-undefined

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jul 4, 2026

Copy link
Copy Markdown
Member

Motivation

Vite reads NODE_ENV through @voidzero-dev/vite-task-client when it runs inside the task runner. The native addon exposed a missing Rust Option<String> as JavaScript null, despite the client contract promising undefined. Assigning that result to process.env.NODE_ENV coerced it to the string "null", causing production builds to expose development import.meta.env flags.

Related to voidzero-dev/vite-plus#2047.

Changes

  • Return an explicit JavaScript undefined for missing environment variables at the N-API boundary.
  • Add a Vite build E2E assertion covering the default production NODE_ENV.
  • Document the user-visible fix in the changelog.

@fengmk2 fengmk2 force-pushed the fix/get-env-undefined branch from de6e445 to 1b1be41 Compare July 4, 2026 14:57
@fengmk2 fengmk2 marked this pull request as ready for review July 4, 2026 15:01
@fengmk2 fengmk2 requested a review from wan9chi July 4, 2026 15:01
@fengmk2 fengmk2 self-assigned this Jul 4, 2026
@fengmk2 fengmk2 marked this pull request as draft July 4, 2026 15:03
Co-authored-by: GPT-5 Codex <codex@openai.com>
@fengmk2 fengmk2 force-pushed the fix/get-env-undefined branch from 1b1be41 to e7ddb97 Compare July 4, 2026 15:05
@fengmk2 fengmk2 marked this pull request as ready for review July 4, 2026 15:09
@fengmk2 fengmk2 marked this pull request as draft July 4, 2026 15:42
@fengmk2 fengmk2 marked this pull request as ready for review July 4, 2026 15:46
@wan9chi

wan9chi commented Jul 4, 2026

Copy link
Copy Markdown
Member

Ah sorry I didn't see your fix before merging mine. 😄 They are essentially the same. I'll close this one.

@wan9chi wan9chi closed this Jul 4, 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.

2 participants