Skip to content

fix(static-config): extract mergeConfig fields#1867

Closed
leno23 wants to merge 1 commit into
voidzero-dev:mainfrom
leno23:codex/static-merge-config-run-1709
Closed

fix(static-config): extract mergeConfig fields#1867
leno23 wants to merge 1 commit into
voidzero-dev:mainfrom
leno23:codex/static-merge-config-run-1709

Conversation

@leno23

@leno23 leno23 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Teach the static Vite config extractor to understand mergeConfig(...) calls.
  • Allow defineConfig(mergeConfig(...)) and mergeConfig({}, defineConfig({...})) to stay statically analyzable when their merged inputs are static enough.
  • Preserve conservative behavior for spreads, computed keys, and non-static fields so dynamic config still falls back when needed.

Closes #1709

Test Plan

  • git diff --check
  • RUSTUP_TOOLCHAIN=stable rustfmt --edition 2024 --check crates/vite_static_config/src/lib.rs

Attempted but blocked locally:

  • RUSTUP_TOOLCHAIN=stable cargo test -p vite-static-config merge_config -- --nocapture failed during workspace dependency resolution because this workspace needs nightly -Z bindeps for fspy from vite-task.
  • Repo nightly toolchain (nightly-2026-06-10) is partially installed locally and rustup stalled while downloading the required components.

@netlify

netlify Bot commented Jun 18, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

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

@leno23 leno23 marked this pull request as ready for review June 18, 2026 04:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a3373dbb9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +248 to +249
(FieldMapInner::Closed(mut left), FieldMapInner::Closed(right)) => {
left.extend(right);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve nested fields when merging configs

Here the static merge treats a later top-level field as a full replacement, but Vite's mergeConfig recursively merges object fields (the existing packages/cli/src/__tests__/define-config-test-field.spec.ts test expects both nested test keys to survive). For mergeConfig({ run: { tasks: { build: { command: '...' } } } }, { run: { cacheScripts: false } }), this returns run with only cacheScripts; packages/cli/binding/src/cli/handler.rs then accepts that Json value without NAPI fallback, so configured tasks from the base config disappear at runtime.

Useful? React with 👍 / 👎.

@fengmk2

fengmk2 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Please take the time to understand the problem you’re trying to solve, rather than handing everything over to AI as a substitute for your own thinking. We can’t do the validation and review for you.

@fengmk2 fengmk2 closed this Jun 19, 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.

Using mergeConfig will cause the build of other packages to fail.

2 participants