fix(static-config): extract mergeConfig fields#1867
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
There was a problem hiding this comment.
💡 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".
| (FieldMapInner::Closed(mut left), FieldMapInner::Closed(right)) => { | ||
| left.extend(right); |
There was a problem hiding this comment.
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 👍 / 👎.
|
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. |
Summary
mergeConfig(...)calls.defineConfig(mergeConfig(...))andmergeConfig({}, defineConfig({...}))to stay statically analyzable when their merged inputs are static enough.Closes #1709
Test Plan
git diff --checkRUSTUP_TOOLCHAIN=stable rustfmt --edition 2024 --check crates/vite_static_config/src/lib.rsAttempted but blocked locally:
RUSTUP_TOOLCHAIN=stable cargo test -p vite-static-config merge_config -- --nocapturefailed during workspace dependency resolution because this workspace needs nightly-Z bindepsforfspyfromvite-task.nightly-2026-06-10) is partially installed locally andrustupstalled while downloading the required components.