Skip to content

Conversation

@jamesopstad
Copy link
Contributor

@jamesopstad jamesopstad commented Sep 25, 2025

This adds optimizeDeps.entries for the client and ssr environments so that dependencies are discovered when starting the dev server.

Summary by CodeRabbit

  • Refactor
    • Simplified internal entry and route aliasing for more consistent build/dev behavior; entry targets made more explicit (no public API changes).
  • Documentation
    • Minor comment clarity improvement.
  • Chores
    • Added a small utility dependency to improve file resolution and dependency discovery during development and build.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Walkthrough

Adds a router alias and simplifies entry-alias resolution in start-plugin-core, changes internal ENTRY_POINTS identifiers, adds tinyglobby as a dependency, and updates default entry file names and a comment in React/Solid Vite plugins; optimizeDeps lists now include escaped alias entries.

Changes

Cohort / File(s) Summary of Changes
React Vite plugin comment
packages/react-start/src/plugin/vite.ts
Minor grammar fix in an optimizeDeps comment; entry default paths updated elsewhere.
Solid Vite defaults
packages/solid-start/src/plugin/vite.ts
Default entry paths changed to explicit filenames (client.tsx, server.ts, start.ts).
Core plugin: aliasing & optimizeDeps
packages/start-plugin-core/src/plugin.ts
Added routerAlias derived from routerFilePath; replaced conditional per-entry resolution with nullish-coalescing defaults (clientAlias, serverAlias, startAlias); unified entry alias map to use aliases (including routerAlias); added optimizeDeps.include entries for client and server environments using escapePath; removed manual node:path alias construction.
Core plugin: constants
packages/start-plugin-core/src/constants.ts
ENTRY_POINTS values changed: client from virtual:tanstack-start-client-entry__tanstack-start-client-entry__; server from virtual:tanstack-start-server-request-entry__tanstack-start-server-entry__.
Core plugin: package manifest
packages/start-plugin-core/package.json
Added dependency tinyglobby (^0.2.15) to dependencies.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant Plugin as start-plugin-core
  participant Const as ENTRY_POINTS
  participant Escape as tinyglobby.escapePath
  participant Vite as Vite Config

  Dev->>Plugin: initialize plugin (client/server/start/router paths)
  Plugin->>Const: read ENTRY_POINTS placeholders
  Plugin->>Plugin: compute aliases (clientAlias, serverAlias, startAlias, routerAlias) using ?? defaults
  Plugin->>Escape: escape alias entries for optimizeDeps.include
  Escape-->>Plugin: escaped paths
  Plugin->>Vite: inject alias map (client/server/start/router)
  Plugin->>Vite: add optimizeDeps.include for client and server using escaped aliases
  Vite-->>Dev: final Vite config with aliases and optimizeDeps
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • fix: various fixes #5215 — modifies start-entry handling and alias/module identifiers similar to ENTRY_POINTS and start-entry usage (likely code-level overlap).

Suggested labels

package: solid-start

Poem

I twitch my whiskers at aliases anew,
A router's tiny path points true.
Client and server hop in line,
Tinyglobby cleans the vine.
A polite comment nibbles through. 🥕🐇

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 clearly and concisely summarizes the main change by stating that optimizeDeps.entries is being added for the client and SSR environments, directly reflecting the pull request’s primary objective without extraneous detail.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Sep 25, 2025

View your CI Pipeline Execution ↗ for commit 9e29f18

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 3m 41s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 14s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-26 03:50:57 UTC

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/start-plugin-core/src/plugin.ts (1)

136-146: Alias computation/readability looks good

The nullish-coalescing defaults with normalizePath are clear and correct. The router alias introduction aligns with the new strategy.

Optional: factor a tiny helper to reduce repetition:

const normWithDefault = (p: string | undefined, d: string) => vite.normalizePath(p ?? d)
const clientAlias = normWithDefault(clientEntryPath, corePluginOpts.defaultEntryPaths.client)
const serverAlias = normWithDefault(serverEntryPath, corePluginOpts.defaultEntryPaths.server)
const startAlias  = normWithDefault(startFilePath,  corePluginOpts.defaultEntryPaths.start)

Also applies to: 153-155

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 86aa74e and 604c720.

📒 Files selected for processing (2)
  • packages/react-start/src/plugin/vite.ts (1 hunks)
  • packages/start-plugin-core/src/plugin.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • packages/react-start/src/plugin/vite.ts
  • packages/start-plugin-core/src/plugin.ts
packages/{*-start,start-*}/**

📄 CodeRabbit inference engine (AGENTS.md)

Name and place Start framework packages under packages/-start/ or packages/start-/

Files:

  • packages/react-start/src/plugin/vite.ts
  • packages/start-plugin-core/src/plugin.ts
🧠 Learnings (1)
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
PR: TanStack/router#0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/

Applied to files:

  • packages/react-start/src/plugin/vite.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test
  • GitHub Check: Preview
🔇 Additional comments (1)
packages/react-start/src/plugin/vite.ts (1)

68-68: LGTM — comment tweak only

Non-behavioral change. Safe.

@jamesopstad jamesopstad marked this pull request as draft September 25, 2025 10:32
@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 25, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5223

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5223

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5223

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5223

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5223

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5223

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5223

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5223

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5223

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5223

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5223

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5223

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5223

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5223

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5223

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5223

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5223

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5223

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5223

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5223

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5223

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5223

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5223

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5223

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5223

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5223

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5223

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5223

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5223

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5223

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5223

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5223

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5223

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5223

commit: 9e29f18

@jamesopstad jamesopstad marked this pull request as ready for review September 25, 2025 12:58
@schiller-manuel schiller-manuel changed the title Add optimizeDeps.entries for client and ssr environments fix: Add optimizeDeps.entries for client and ssr environments Sep 26, 2025
@schiller-manuel schiller-manuel merged commit 716cc05 into TanStack:main Sep 26, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants