TanStack / TanStack/router

some peer dependencies (@tanstack/query-core, @tanstack/router-core) are unresolvable with strict package managers

Open
#6,347 0 comments 4 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

When using TanStack Start/Router/Query in a monorepo environment managed by Yarn 4 with the pnpm linker (nodeLinker: pnpm), internal core packages fail to resolve their peer dependencies.
Specifically, @tanstack/router-ssr-query-core (a dependency of @tanstack/react-router-ssr-query) cannot find @tanstack/query-core and @tanstack/router-core during Vite's dependency optimization (esbuild) phase.

The -core packages are not receiving the peer dependencies they require from their framework-specific wrappers.

Your Example Website or App

https://github.com/AlexanderOpran/my-app

Steps to Reproduce the Bug or Issue
yarn install
yarn dev
Expected behavior

Peer dependencies should correctly propagate through the framework wrappers to their internal core packages, ensuring compatibility with strict package management strategies (like the Yarn pnpm linker) without requiring a hoisted (flat) node_modules structure or the explicit addition of these core packages as direct dependencies to the application workspace.

I plan to investigate this further and hope to submit a PR that not only resolves the current resolution issues but perhaps also introduce a preventative CI step or custom script (e.g., using yarn or pnpm dependency analysis) to ensure long-term compatibility with strict linkers.

Screenshots or Videos

No response

Platform
  • Router / Start Version: 1.132.0
  • OS: Windows 11 25H2 (26200.7462)
  • Runtime: NodeJS v24.12.0 (LTS)
  • Bundler: Vite 7.1.7
Additional context

Error Logs (yarn dev)

[@my-app/web]: X [ERROR] Could not resolve "@tanstack/query-core" [@my-app/web]: [@my-app/web]: ../../node_modules/.store/@tanstack-router-ssr-query-core-virtual-2f971716a3/package/dist/esm/index.js:1:35: [@my-app/web]: 1 │ import { dehydrate, hydrate } from "@tanstack/query-core"; [@my-app/web]: ╵ ~~~~~~~~~~~~~~~~~~~~~~ [@my-app/web]: [@my-app/web]: You can mark the path "@tanstack/query-core" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. [@my-app/web]: [@my-app/web]: X [ERROR] Could not resolve "@tanstack/router-core" [@my-app/web]: [@my-app/web]: ../../node_modules/.store/@tanstack-router-ssr-query-core-virtual-2f971716a3/package/dist/esm/index.js:2:27: [@my-app/web]: 2 │ import { isRedirect } from "@tanstack/router-core"; [@my-app/web]: ╵ ~~~~~~~~~~~~~~~~~~~~~~~

Yarn Peer Requirements Analysis

Package @my-app/web@workspace:packages/web is requested to provide @tanstack/query-core by its descendants
@my-app/web@workspace:packages/web
└─ @tanstack/react-router-ssr-query@npm:1.147.0 [d8879] (via >=5.90.0)
   └─ @tanstack/router-ssr-query-core@npm:1.146.2 [8b6e8] (via >=5.90.0)
✘ Package @my-app/web@workspace:packages/web does not provide @tanstack/query-core.

Package @my-app/web@workspace:packages/web is requested to provide @tanstack/router-core by its descendants
@my-app/web@workspace:packages/web
└─ @tanstack/react-router-devtools@npm:1.147.0 [d8879] (via ^1.146.2)
   └─ @tanstack/router-devtools-core@npm:1.146.2 [90cc2] (via ^1.146.2)
✘ Package @my-app/web@workspace:packages/web does not provide @tanstack/router-core.

PNPM Warnings

 WARN  Issues with peer dependencies found
.
├─┬ @tanstack/react-devtools 0.7.0
│ └─┬ @tanstack/devtools 0.6.14
│   └─┬ goober 2.1.18
│     └── ✕ missing peer csstype@^3.0.10
├─┬ @tanstack/react-router-devtools 1.132.0
│ └─┬ @tanstack/router-devtools-core 1.132.0
│   ├── ✕ missing peer csstype@^3.0.10
│   ├── ✕ missing peer tiny-invariant@^1.3.3
│   └── ✕ missing peer @tanstack/router-core@^1.132.0
├─┬ @tanstack/react-router-ssr-query 1.131.7
│ ├── ✕ missing peer @tanstack/query-core@>=5.66.0
│ ├── ✕ missing peer @tanstack/react-query@>=5.66.2
│ └─┬ @tanstack/router-ssr-query-core 1.131.7
│   ├── ✕ missing peer @tanstack/router-core@>=1.127.0
│   └── ✕ missing peer @tanstack/query-core@>=5.66.0
├─┬ vite 7.1.7
│ └── ✕ unmet peer @types/node@"^20.19.0 || >=22.12.0": found 22.10.2
└─┬ @tailwindcss/vite 4.0.6
  └── ✕ unmet peer vite@"^5.2.0 || ^6": found 7.1.7
Peer dependencies that should be installed:
  @tanstack/query-core@>=5.66.0             csstype@">=3.0.10 <4.0.0-0"
  @tanstack/react-query@>=5.66.2            tiny-invariant@^1.3.3
  @tanstack/router-core@">=1.132.0 <2.0.0"

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

Reproduce the failure in the linked example with yarn install followed by yarn dev, focusing on Vite dependency optimization. Inspect dependency declarations for @tanstack/router-ssr-query-core, @tanstack/react-router-ssr-query, @tanstack/router-devtools-core, and their framework wrappers. Done means the core peer dependencies resolve with Yarn's pnpm linker without extra direct application dependencies, with any preventative check supported by the repository.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.