⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

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

@AlexanderOpran

Description

@AlexanderOpran

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions