fix: optimizeDeps for react-form-start
Tanstack Form has silently created a new package named @tanstack/react-form-start recently. Branch
The usage example is in this docs.
This PR, also optimize deps for @tanstack/react-form-start to fix vite not resolving the use-sync-external-store package.
Summary by CodeRabbit
- Chores
- Updated Vite plugin to improve dependency optimization handling for TanStack React Start packages, adding a conditional inclusion for the "start" form package.
- Adjusted Cloudflare environment typings to preserve literal value types and improve formatting of the declared environment mapping.
βοΈ Tip: You can customize this high-level summary in your review settings.
Walkthrough
Adds a conditional transitive include to the Vite optimizeDeps list for the react-start plugin and adjusts Cloudflare Env typing in an e2e declaration, preserving literal types and formatting.
Changes
| Cohort / File(s) | Summary |
|---|---|
Vite plugin optimizeDeps configuration packages/react-start/src/plugin/vite.ts |
Add conditional spread that includes '@tanstack/react-form-start > @tanstack/react-store' in optimizeDeps.include when '@tanstack/react-form-start' appears in optimizeDeps.exclude, mirroring the existing pattern for '@tanstack/react-form'. |
Cloudflare Env typings (e2e) e2e/solid-start/basic-cloudflare/worker-configuration.d.ts |
Adjust formatting and literal typing: change MY_VAR string literal quoting/formatting; update StringifyValues<M> to preserve EnvType[Binding] when a bound is a string (instead of forcing string); update NodeJS.ProcessEnv pick to reflect the preserved literal type. |
Sequence Diagram(s)
N/A β changes are configuration and type adjustments that don't modify runtime control flow.
Estimated code review effort
π― 3 (Moderate) | β±οΈ ~20 minutes
- Review Vite plugin conditional logic to ensure pattern matches existing implementation.
- Verify the d.ts typing changes preserve intended literal types and don't widen types unexpectedly.
- Check e2e typing formatting for consistency with surrounding declarations.
Possibly related PRs
- TanStack/router#5726 β Adds the same conditional transitive include pattern for
@tanstack/react-formin the Vite plugin, which this PR mirrors for the "start" variant. - TanStack/router#5223 β Related modifications to
optimizeDepsconfiguration in the same Vite plugin file.
Poem
π° I hopped through configs, tidy and smart,
Mirrored a rule for the form-start part.
Typings trimmed neat, includes set just right,
Bundles hum softly into the night. β¨
Pre-merge checks and finishing touches
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
β Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The title 'fix: optimizeDeps for react-form-start' directly and clearly describes the main change: adding optimizeDeps configuration for the react-form-start package to resolve Vite dependency issues. |
β¨ Finishing touches
- [ ] π Generate docstrings
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
π Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π₯ Commits
Reviewing files that changed from the base of the PR and between 61db78a0202bcefb816e2bb2512949371de0b66a and a27bfbfbf651cdfcb3fb71390d8ad30c6323ba46.
π Files selected for processing (1)
e2e/solid-start/basic-cloudflare/worker-configuration.d.ts(1 hunks)
π§° Additional context used
π§ Learnings (1)
π Common learnings
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.
π Additional comments (1)
e2e/solid-start/basic-cloudflare/worker-configuration.d.ts (1)
5-7: Env/StringifyValues typing change is sound and improves literal safetyDefining
MY_VARas the literal'Hello from Cloudflare'and updatingStringifyValuesto preserve literalstringtypes while collapsing nonβstring env bindings tostringmakesProcessEnvmore precise without breaking the string-only runtime contract. ThePick<Cloudflare.Env, 'MY_VAR'>usage ensuresprocess.env.MY_VARis correctly typed to that literal in this e2e setup.Only minor thing to keep in mind: if
StringifyValuesis reused elsewhere with union types likestring | undefinedorstring | number, those will now fall back tostring, which still matches how environment variables behave but slightly changes previous type inferences. If thatβs intentional, this looks good to ship.Also applies to: 11-14, 16-17
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
View your CI Pipeline Execution β for commit a27bfbfbf651cdfcb3fb71390d8ad30c6323ba46
| Command | Status | Duration | Result |
|---|---|---|---|
nx affected --targets=test:eslint,test:unit,tes... |
β Cancelled | 22s | View β |
nx run-many --target=build --exclude=examples/*... |
β Succeeded | 10s | View β |
βοΈ Nx Cloud last updated this comment at 2025-11-21 13:55:36 UTC