-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Which project does this relate to?
Start
Describe the bug
When a createServerFn is only called from a createFileRoute handler (server-side) and not use in any client-side code, it gets tree-shaken during production build, causing runtime errors.
Reproduction
// src/routes/api.ts
const serverFn = createServerFn({ method: "POST" })
.handler(async ({ data }) => {
console.log("This never runs"); // ❌ Never executes
// ...
});
export const Route = createFileRoute("/api")({
server: {
handlers: {
POST: async ({ request }) => {
serverFn(); // ❌ throw 500
// ...
},
},
},
});Environment
@tanstack/react-start: ^1.139.8
vite: ^7.1.7
Build target: Production (works fine in dev mode)
Your Example Website or App
//
Steps to Reproduce the Bug or Issue
//
Expected behavior
//
Screenshots or Videos
No response
Platform
//
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels