Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
"@tanstack/query-core": "^5.99.0",
"@tanstack/react-query": "^5.99.0",
"@tanstack/solid-query": "^5.99.0",
"@tanstack/vue-query": "^5.99.0",
"@tanstack/vite-config": "0.5.2",
"@tanstack/vue-query": "^5.99.0",
"@types/node": "25.0.9",
"@types/react": "^19.2.8",
"@types/react-dom": "^19.2.3",
Expand Down Expand Up @@ -143,5 +143,8 @@
"@tanstack/start-static-server-functions": "workspace:*",
"@tanstack/nitro-v2-vite-plugin": "workspace:*"
}
},
"dependencies": {
"@tanstack/react-start": "1.167.57"
}
Comment on lines +147 to 149
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Root dependency value:"
jq -r '.dependencies["@tanstack/react-start"] // "<missing>"' package.json

echo "Override value:"
jq -r '.pnpm.overrides["@tanstack/react-start"] // "<missing>"' package.json

echo "Verify this package exists in workspace:"
fd -i 'package.json$' | xargs -r jq -r 'select(.name=="@tanstack/react-start") | input_filename'

Repository: TanStack/router

Length of output: 194


Use workspace protocol for internal @tanstack/react-start dependency

This internal workspace package should use workspace:* instead of a pinned external version to maintain consistency with the pnpm override already set for it.

Proposed change
   "dependencies": {
-    "@tanstack/react-start": "1.167.57"
+    "@tanstack/react-start": "workspace:*"
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"dependencies": {
"@tanstack/react-start": "1.167.57"
}
"dependencies": {
"@tanstack/react-start": "workspace:*"
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 147 - 149, The package.json currently pins the
internal package "@tanstack/react-start" to an external version; update the
dependencies entry for "@tanstack/react-start" to use the workspace protocol by
replacing its version string with "workspace:*" so the project uses the local
workspace package consistent with the pnpm override.

}
35 changes: 24 additions & 11 deletions packages/start-plugin-core/src/vite/start-compiler-plugin/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ import type {
GenerateFunctionIdFnOptional,
ServerFn,
} from '../../start-compiler/types'
import type { EnvironmentModuleNode, PluginOption } from 'vite'
import type {
DevEnvironment,
EnvironmentModuleNode,
HotUpdateOptions,
PluginOption,
} from 'vite'

// Re-export from shared constants for backwards compatibility
export { SERVER_FN_LOOKUP }
Expand Down Expand Up @@ -276,20 +281,27 @@ export function startCompilerPlugin(
)
}

await this.environment.transformRequest(
await (this.environment as DevEnvironment).transformRequest(
`${id}?${SERVER_FN_LOOKUP}`,
)
},

resolveId: async (source: string, importer?: string) => {
const r = await this.resolve(source, importer)

if (r) {
if (!r.external) {
return cleanId(r.id)
try {
const r = await this.resolve(source, importer)
if (r) {
if (!r.external) {
return cleanId(r.id)
}
}
} catch (err) {
if (
err instanceof Error &&
err.message.includes('Plugin driver is already dropped')
) {
return null
}
throw err
}

return null
},
})
Expand All @@ -311,7 +323,7 @@ export function startCompilerPlugin(
},
},

hotUpdate(ctx) {
hotUpdate(ctx: HotUpdateOptions) {
const compiler = compilers.get(this.environment.name)
const idsToInvalidate = new Set<string>()
const transitiveCompilerImportersToInvalidate = new Set<string>()
Expand Down Expand Up @@ -462,7 +474,7 @@ export function startCompilerPlugin(
)
}

await this.environment.transformRequest(
await (this.environment as DevEnvironment).transformRequest(
`${absPath}?${SERVER_FN_LOOKUP}`,
)

Expand Down Expand Up @@ -501,6 +513,7 @@ export function startCompilerPlugin(
this.error(
`No getServerFnById implementation found for caller environment: ${this.environment.name}`,
)
return
}

if (this.environment.mode !== 'build') {
Expand Down
11 changes: 8 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.