TanStack / TanStack/router

Some server-side modules incorrectly bundled into the client?

Open
#5,738 22 comments 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.1k
Forks
1.9k
Avg merge
1d 20h
Merged PRs (30d)
143

Description

Which project does this relate to?

Start

Describe the bug

Starting with @tanstack/react-start@1.134.7, I think server-side modules are being incorrectly bundled into the client bundle. For example, in the Clerk SDK, this error shows up in the browser console when running dev server:

Uncaught (in promise) SyntaxError: The requested module '/node_modules/cookie/dist/index.js?v=d2ee33e7' does not provide an export named 'parse' (at chunk-CEKR2FXD.mjs?v=d2ee33e7:4283:10)Understand this error
client:865 

Likely related to https://github.com/TanStack/router/issues/5717

Your Example Website or App

https://github.com/clerk/clerk-tanstack-react-start-quickstart/pull/6/files

Steps to Reproduce the Bug or Issue
  1. Clone the repo attached
  2. Switch to the cookie-module-leak branch
  3. Run npm run dev, see browser console
Expected behavior

Properly externalize server-side modules in client builds.

Screenshots or Videos

No response

Platform
  • Router / Start Version: 1.134.9
  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Browser Version: [e.g. 91.1]
  • Bundler: Vite
  • Bundler Version: [e.g. 7.0.0]
Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked Clerk quickstart, switch to the cookie-module-leak branch, and run npm run dev to reproduce the browser error. Use the related TanStack Router issue 5717 and the client bundle behavior as starting points; done means server-side modules such as cookie are properly externalized from client builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript, vite
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.