fix(router-devtools-core): bundle solid for smaller package #5374
main fromrefs/pull/5374/head·merged by birkskyum(GitHub profile, opens in a new tab) It's pretty weird to be downloading solid into a react app and it adds an extra 3.5MB: https://pkg-size.dev/solid-js
By bundling solid we end up with a much smaller package since we keep only the parts of it that are used (~40kb) and tree-shake away the rest. This prevents deduping for solid users, so it's larger for those users. However, there are 3,700 weekly downloads from solid and 1 million from react, so this is a huge savings overall.
Summary by CodeRabbit#
- Chores
- Updated package metadata and public entry points for the router devtools core package.
- Moved a framework dependency to development-only and removed its peer-dependency declaration to reduce install warnings.
- Clarified module entry exports to improve packaging; no functional changes for end users.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-devtools-core
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between e94e9c7321ce8ba213ee421b4e1369429ffea384 and 371bb85d4ee64336cc86415ccc6bd728554d758d.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (1)
packages/router-devtools-core/package.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/package.json
📄 CodeRabbit inference engine (AGENTS.md)
Use workspace:* protocol for internal dependencies in package.json files
Files:
packages/router-devtools-core/package.json
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{router-devtools,*-router-devtools}/** : Keep router devtools packages in packages/router-devtools/ and packages/*-router-devtools/Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/router-core/** : Keep framework-agnostic core router logic in packages/router-core/Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{router-cli,router-generator,router-plugin,virtual-file-routes}/** : Keep CLI, generators, bundler plugins, and virtual file routing utilities in their dedicated tooling package directories📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{router-devtools,*-router-devtools}/** : Keep router devtools packages in packages/router-devtools/ and packages/*-router-devtools/Applied to files:
packages/router-devtools-core/package.json
@@ -64,7 +64,7 @@6464 "dependencies": {6565 "clsx": "^2.1.1",6666 "goober": "^2.1.16",67- "solid-js": "^1.9.5",6867 "vite": "^7.1.7"6968 },7069 "devDependencies": {70+ "solid-js": "^1.9.5",⚠️ Potential issue | 🔴 Critical
Do not drop the
solid-jsruntime/type dependencydist/esm/index.d.tsstill declaresimport { render } from "solid-js/web"andimport { Component, JSX } from "solid-js". When React consumers install this package they will no longer getsolid-js, so TypeScript fails to resolve those modules and runtime imports break. Bundling the JS doesn’t ship the.d.ts, so we still needsolid-jslisted as a real dependency (and likely a peer dependency) for consumers. Please restoresolid-jstodependencies/peerDependenciesor copy the necessary type/runtime code into the package.Apply this diff to restore the dependency:
- "dependencies": { - "clsx": "^2.1.1", - "goober": "^2.1.16", - "vite": "^7.1.7" - }, - "devDependencies": { - "solid-js": "^1.9.5", - "vite-plugin-solid": "^2.11.8" - }, - "peerDependencies": { - "@tanstack/router-core": "workspace:^", - "csstype": "^3.0.10", - "tiny-invariant": "^1.3.3" - }, + "dependencies": { + "clsx": "^2.1.1", + "goober": "^2.1.16", + "solid-js": "^1.9.5", + "vite": "^7.1.7" + }, + "devDependencies": { + "vite-plugin-solid": "^2.11.8" + }, + "peerDependencies": { + "@tanstack/router-core": "workspace:^", + "csstype": "^3.0.10", + "solid-js": ">=1.9.5", + "tiny-invariant": "^1.3.3" + },📝 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.
"dependencies": { "clsx": "^2.1.1", "goober": "^2.1.16", "solid-js": "^1.9.5", "vite": "^7.1.7" }, "devDependencies": { "vite-plugin-solid": "^2.11.8" }, "peerDependencies": { "@tanstack/router-core": "workspace:^", "csstype": "^3.0.10", "solid-js": ">=1.9.5", "tiny-invariant": "^1.3.3" },🤖 Prompt for AI Agents
In packages/router-devtools-core/package.json around line 70, the package removed the "solid-js" dependency but the distributed types and runtime still import from "solid-js" and "solid-js/web", causing TypeScript resolution and runtime import failures for consumers; restore "solid-js" as a dependency (and add it to peerDependencies if you expect consumers to provide their own compatible runtime) or alternatively include the necessary runtime/type code in the package and update types accordingly; update package.json to re-add "solid-js" under "dependencies" and optionally under "peerDependencies", then bump the package version and rebuild to ensure dist/.d.ts and bundled code align with declared dependencies.That's not correct:
$ cat dist/esm/index.d.ts export { TanStackRouterDevtoolsCore } from './TanStackRouterDevtoolsCore.js'; export { TanStackRouterDevtoolsPanelCore } from './TanStackRouterDevtoolsPanelCore.js';🧩 Analysis chain
🏁 Script executed:
#!/bin/bash # Check the actual content of dist/esm/index.d.ts echo "=== Content of dist/esm/index.d.ts ===" cat packages/router-devtools-core/dist/esm/index.d.ts 2>/dev/null || echo "File not found in repository" echo -e "\n=== Searching for any .d.ts files that import from solid-js ===" fd -e d.ts -e d.cts . packages/router-devtools-core/dist 2>/dev/null --exec rg -l "from ['\"]solid-js" {} \; || echo "No dist directory or no matches found" echo -e "\n=== Check vite config for bundling configuration ===" fd "vite.config" packages/router-devtools-core --exec cat {} \; echo -e "\n=== Check tsconfig for any solid-js type references ===" cat packages/router-devtools-core/tsconfig.json 2>/dev/null || echo "tsconfig.json not found" echo -e "\n=== Check if dist directory exists and list its structure ===" fd . packages/router-devtools-core/dist -t f --max-depth 3 2>/dev/null | head -20 || echo "dist directory not found"Length of output: 913
🏁 Script executed:
#!/bin/bash # Check the source index file echo "=== Source index file ===" cat packages/router-devtools-core/src/index.tsx echo -e "\n=== Check all source files for solid-js imports ===" rg -n "from ['\"]solid-js" packages/router-devtools-core/src/ echo -e "\n=== Check tanstackViteConfig to understand bundling ===" fd "vite" packages/tanstack/config/vite --exec cat {} \; 2>/dev/null || echo "Config not found" echo -e "\n=== Check for any type exports that might reference solid-js ===" rg -n "export.*from.*solid-js" packages/router-devtools-core/src/Length of output: 3310
🏁 Script executed:
#!/bin/bash # Find and check the tanstack config vite setup echo "=== Find tanstack config vite files ===" fd -t f "vite" packages/config echo -e "\n=== Check the main vite config ===" cat packages/config/vite.config.ts 2>/dev/null || cat packages/config/src/vite/index.ts 2>/dev/null || echo "Config file not found" echo -e "\n=== List config package structure ===" fd -t f . packages/config | head -20 echo -e "\n=== Check package.json exports in config ===" cat packages/config/package.json | jq '.exports' 2>/dev/null || echo "package.json not found"Length of output: 449
🏁 Script executed:
#!/bin/bash # Find @tanstack/config package echo "=== Find @tanstack/config ===" fd -t f "package.json" | xargs grep -l "@tanstack/config" | head -5 echo -e "\n=== Search for tanstackViteConfig definition ===" rg -n "tanstackViteConfig" --type ts -A 5 | head -40 echo -e "\n=== Check if solid-js is marked as external in any build config ===" rg -n "external.*solid" --type ts --type js echo -e "\n=== Check the actual vite build config more carefully ===" cat packages/router-devtools-core/vite.config.tsLength of output: 2967
🏁 Script executed:
#!/bin/bash # Find the actual tanstackViteConfig implementation echo "=== Search in node_modules for @tanstack/config ===" fd -t f "index" node_modules/@tanstack/config --exec cat {} \; 2>/dev/null | head -100 echo -e "\n=== Alternative: Check if there's a local config directory ===" fd -t d "config" -d 2 | grep -v node_modules | head -10 echo -e "\n=== Look for build config in the monorepo root ===" cat tsup.config.ts 2>/dev/null || echo "No tsup.config.ts" echo -e "\n=== Check what's in the root package.json workspaces ===" cat package.json | jq '.workspaces' 2>/dev/null echo -e "\n=== Check the PR diff to see if anything related to bundling changed ===" git diff origin/main...HEAD -- packages/router-devtools-core/vite.config.ts 2>/dev/null || echo "No vite config changes in this PR"Length of output: 356
🏁 Script executed:
#!/bin/bash # Check if this package exports any types that consumers would use echo "=== Check what types are exported from the package ===" rg -n "export type" packages/router-devtools-core/src/index.tsx echo -e "\n=== Check the main exported components ===" cat packages/router-devtools-core/src/TanStackRouterDevtoolsCore.tsx | head -50 echo -e "\n=== Check if solid-router package has similar bundling setup ===" cat packages/solid-router/package.json | jq '.dependencies, .devDependencies, .peerDependencies' echo -e "\n=== Check the full PR diff for router-devtools-core package.json ===" git diff origin/main...HEAD -- packages/router-devtools-core/package.json echo -e "\n=== Check how other devtools packages handle dependencies ===" cat packages/react-router-devtools/package.json | jq '.dependencies, .devDependencies, .peerDependencies'Length of output: 2862
🏁 Script executed:
#!/bin/bash # Check what the exported components' type signatures look like echo "=== Check TanStackRouterDevtoolsCore types ===" cat packages/router-devtools-core/src/TanStackRouterDevtoolsCore.tsx | grep -A 30 "export.*TanStackRouterDevtoolsCore" echo -e "\n=== Check TanStackRouterDevtoolsPanelCore types ===" cat packages/router-devtools-core/src/TanStackRouterDevtoolsPanelCore.tsx | grep -A 30 "export.*TanStackRouterDevtoolsPanelCore" echo -e "\n=== Check if any solid-js types leak into public API ===" rg -n "export.*\b(JSX|Signal|Accessor|Component)\b.*from" packages/router-devtools-core/src/index.tsx packages/router-devtools-core/src/TanStackRouterDevtoolsCore.tsx packages/router-devtools-core/src/TanStackRouterDevtoolsPanelCore.tsx echo -e "\n=== Verify the actual function signatures that consumers use ===" cat packages/router-devtools-core/src/TanStackRouterDevtoolsCore.tsx | tail -10 cat packages/router-devtools-core/src/TanStackRouterDevtoolsPanelCore.tsx | tail -10Length of output: 706
🏁 Script executed:
#!/bin/bash # Check how this package is consumed by react-router-devtools echo "=== Check react-router-devtools usage ===" cat packages/react-router-devtools/src/index.tsx | head -30 echo -e "\n=== Check solid-router-devtools usage ===" cat packages/solid-router-devtools/src/index.tsx 2>/dev/null | head -30 || echo "solid-router-devtools not found" echo -e "\n=== Search for how router-devtools-core is imported ===" rg -n "from.*router-devtools-core" packages/ -A 2 -B 2 | head -50 echo -e "\n=== Check the full class definition to understand if it's just a class ===" cat packages/router-devtools-core/src/TanStackRouterDevtoolsCore.tsx | grep -A 5 "^class\|^export class"Length of output: 3379
@benmccann You're absolutely right, and I apologize for the incorrect assessment.
After checking the actual source code and how this package is consumed, I now understand:
- The package exports framework-agnostic classes (
TanStackRouterDevtoolsCoreandTanStackRouterDevtoolsPanelCore), not Solid components - Solid is bundled internally by vite-plugin-solid, so the Solid runtime code becomes part of the package's JavaScript output
- The type definitions are clean - as you showed,
dist/esm/index.d.tsonly re-exports the classes without any Solid type references - Both React and Solid consumers use these classes - the wrapper packages (
@tanstack/react-router-devtoolsand@tanstack/solid-router-devtools) integrate them with their respective frameworks
The change to move
solid-jstodevDependenciesis correct because consumers don't need Solid installed - they only interact with the bundled JavaScript classes. My concern about TypeScript resolution was unfounded.Thank you for the correction! 🐰
🐰 ( •ㅅ•) ┏━━━┓ ┃📚 ┃ Learning from mistakes! ┗━━━┛
🧠 Learnings used
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/cc @birkskyum
View your CI Pipeline Execution ↗ for commit e4c58d9801a44b8729e5fefee4385444cdc5e8c2
Command Status Duration Result nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded 4m 9s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 16s View ↗
☁️ Nx Cloud last updated this comment at
2025-10-06 01:44:57UTCMore templates
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-devtools-panel
- tanstack-router-solid-example-basic-file-based
- tanstack-router-solid-example-basic-non-nested-devtools
- tanstack-router-solid-example-basic-solid-query
- tanstack-router-solid-example-basic-solid-query-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-solid-start-example-bare
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-static
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-i18n-paraglide
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-i18n-paraglide
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
@tanstack/arktype-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5374@tanstack/directive-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5374@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5374@tanstack/history
npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5374@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5374@tanstack/react-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5374@tanstack/react-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5374@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5374@tanstack/react-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5374@tanstack/react-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5374@tanstack/react-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5374@tanstack/router-cli
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5374@tanstack/router-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5374@tanstack/router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5374@tanstack/router-devtools-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5374@tanstack/router-generator
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5374@tanstack/router-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5374@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5374@tanstack/router-utils
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5374@tanstack/router-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5374@tanstack/server-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5374@tanstack/solid-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5374@tanstack/solid-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5374@tanstack/solid-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5374@tanstack/solid-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5374@tanstack/solid-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5374@tanstack/start-client-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5374@tanstack/start-plugin-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5374@tanstack/start-server-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5374@tanstack/start-static-server-functions
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5374@tanstack/start-storage-context
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5374@tanstack/valibot-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5374@tanstack/virtual-file-routes
npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5374@tanstack/zod-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5374commit:
e4c58d9In theory, it should be possible to bundle it, and arguable it would be best due to the MB of savings . I remember there was a bug reported about something that couldn't find solid, that made us move the solid package to dependency which resolved it, so we should make sure that issue doest reappear
Ah, thank you for the pointer! It sounds like we should test this with yarn: https://github.com/TanStack/router/pull/4376#issuecomment-2969278520
I'll try the pkg.pr.new build later when I get some time.
benmccann(GitHub profile, opens in a new tab)replied on
packages/router-devtools-core/package.jsonline 70That's not correct:
$ cat dist/esm/index.d.ts export { TanStackRouterDevtoolsCore } from './TanStackRouterDevtoolsCore.js'; export { TanStackRouterDevtoolsPanelCore } from './TanStackRouterDevtoolsPanelCore.js';coderabbitai[bot](GitHub profile, opens in a new tab)replied on
packages/router-devtools-core/package.jsonline 70🧩 Analysis chain
🏁 Script executed:
#!/bin/bash # Check the actual content of dist/esm/index.d.ts echo "=== Content of dist/esm/index.d.ts ===" cat packages/router-devtools-core/dist/esm/index.d.ts 2>/dev/null || echo "File not found in repository" echo -e "\n=== Searching for any .d.ts files that import from solid-js ===" fd -e d.ts -e d.cts . packages/router-devtools-core/dist 2>/dev/null --exec rg -l "from ['\"]solid-js" {} \; || echo "No dist directory or no matches found" echo -e "\n=== Check vite config for bundling configuration ===" fd "vite.config" packages/router-devtools-core --exec cat {} \; echo -e "\n=== Check tsconfig for any solid-js type references ===" cat packages/router-devtools-core/tsconfig.json 2>/dev/null || echo "tsconfig.json not found" echo -e "\n=== Check if dist directory exists and list its structure ===" fd . packages/router-devtools-core/dist -t f --max-depth 3 2>/dev/null | head -20 || echo "dist directory not found"Length of output: 913
🏁 Script executed:
#!/bin/bash # Check the source index file echo "=== Source index file ===" cat packages/router-devtools-core/src/index.tsx echo -e "\n=== Check all source files for solid-js imports ===" rg -n "from ['\"]solid-js" packages/router-devtools-core/src/ echo -e "\n=== Check tanstackViteConfig to understand bundling ===" fd "vite" packages/tanstack/config/vite --exec cat {} \; 2>/dev/null || echo "Config not found" echo -e "\n=== Check for any type exports that might reference solid-js ===" rg -n "export.*from.*solid-js" packages/router-devtools-core/src/Length of output: 3310
🏁 Script executed:
#!/bin/bash # Find and check the tanstack config vite setup echo "=== Find tanstack config vite files ===" fd -t f "vite" packages/config echo -e "\n=== Check the main vite config ===" cat packages/config/vite.config.ts 2>/dev/null || cat packages/config/src/vite/index.ts 2>/dev/null || echo "Config file not found" echo -e "\n=== List config package structure ===" fd -t f . packages/config | head -20 echo -e "\n=== Check package.json exports in config ===" cat packages/config/package.json | jq '.exports' 2>/dev/null || echo "package.json not found"Length of output: 449
🏁 Script executed:
#!/bin/bash # Find @tanstack/config package echo "=== Find @tanstack/config ===" fd -t f "package.json" | xargs grep -l "@tanstack/config" | head -5 echo -e "\n=== Search for tanstackViteConfig definition ===" rg -n "tanstackViteConfig" --type ts -A 5 | head -40 echo -e "\n=== Check if solid-js is marked as external in any build config ===" rg -n "external.*solid" --type ts --type js echo -e "\n=== Check the actual vite build config more carefully ===" cat packages/router-devtools-core/vite.config.tsLength of output: 2967
🏁 Script executed:
#!/bin/bash # Find the actual tanstackViteConfig implementation echo "=== Search in node_modules for @tanstack/config ===" fd -t f "index" node_modules/@tanstack/config --exec cat {} \; 2>/dev/null | head -100 echo -e "\n=== Alternative: Check if there's a local config directory ===" fd -t d "config" -d 2 | grep -v node_modules | head -10 echo -e "\n=== Look for build config in the monorepo root ===" cat tsup.config.ts 2>/dev/null || echo "No tsup.config.ts" echo -e "\n=== Check what's in the root package.json workspaces ===" cat package.json | jq '.workspaces' 2>/dev/null echo -e "\n=== Check the PR diff to see if anything related to bundling changed ===" git diff origin/main...HEAD -- packages/router-devtools-core/vite.config.ts 2>/dev/null || echo "No vite config changes in this PR"Length of output: 356
🏁 Script executed:
#!/bin/bash # Check if this package exports any types that consumers would use echo "=== Check what types are exported from the package ===" rg -n "export type" packages/router-devtools-core/src/index.tsx echo -e "\n=== Check the main exported components ===" cat packages/router-devtools-core/src/TanStackRouterDevtoolsCore.tsx | head -50 echo -e "\n=== Check if solid-router package has similar bundling setup ===" cat packages/solid-router/package.json | jq '.dependencies, .devDependencies, .peerDependencies' echo -e "\n=== Check the full PR diff for router-devtools-core package.json ===" git diff origin/main...HEAD -- packages/router-devtools-core/package.json echo -e "\n=== Check how other devtools packages handle dependencies ===" cat packages/react-router-devtools/package.json | jq '.dependencies, .devDependencies, .peerDependencies'Length of output: 2862
🏁 Script executed:
#!/bin/bash # Check what the exported components' type signatures look like echo "=== Check TanStackRouterDevtoolsCore types ===" cat packages/router-devtools-core/src/TanStackRouterDevtoolsCore.tsx | grep -A 30 "export.*TanStackRouterDevtoolsCore" echo -e "\n=== Check TanStackRouterDevtoolsPanelCore types ===" cat packages/router-devtools-core/src/TanStackRouterDevtoolsPanelCore.tsx | grep -A 30 "export.*TanStackRouterDevtoolsPanelCore" echo -e "\n=== Check if any solid-js types leak into public API ===" rg -n "export.*\b(JSX|Signal|Accessor|Component)\b.*from" packages/router-devtools-core/src/index.tsx packages/router-devtools-core/src/TanStackRouterDevtoolsCore.tsx packages/router-devtools-core/src/TanStackRouterDevtoolsPanelCore.tsx echo -e "\n=== Verify the actual function signatures that consumers use ===" cat packages/router-devtools-core/src/TanStackRouterDevtoolsCore.tsx | tail -10 cat packages/router-devtools-core/src/TanStackRouterDevtoolsPanelCore.tsx | tail -10Length of output: 706
🏁 Script executed:
#!/bin/bash # Check how this package is consumed by react-router-devtools echo "=== Check react-router-devtools usage ===" cat packages/react-router-devtools/src/index.tsx | head -30 echo -e "\n=== Check solid-router-devtools usage ===" cat packages/solid-router-devtools/src/index.tsx 2>/dev/null | head -30 || echo "solid-router-devtools not found" echo -e "\n=== Search for how router-devtools-core is imported ===" rg -n "from.*router-devtools-core" packages/ -A 2 -B 2 | head -50 echo -e "\n=== Check the full class definition to understand if it's just a class ===" cat packages/router-devtools-core/src/TanStackRouterDevtoolsCore.tsx | grep -A 5 "^class\|^export class"Length of output: 3379
@benmccann You're absolutely right, and I apologize for the incorrect assessment.
After checking the actual source code and how this package is consumed, I now understand:
- The package exports framework-agnostic classes (
TanStackRouterDevtoolsCoreandTanStackRouterDevtoolsPanelCore), not Solid components - Solid is bundled internally by vite-plugin-solid, so the Solid runtime code becomes part of the package's JavaScript output
- The type definitions are clean - as you showed,
dist/esm/index.d.tsonly re-exports the classes without any Solid type references - Both React and Solid consumers use these classes - the wrapper packages (
@tanstack/react-router-devtoolsand@tanstack/solid-router-devtools) integrate them with their respective frameworks
The change to move
solid-jstodevDependenciesis correct because consumers don't need Solid installed - they only interact with the bundled JavaScript classes. My concern about TypeScript resolution was unfounded.Thank you for the correction! 🐰
🐰 ( •ㅅ•) ┏━━━┓ ┃📚 ┃ Learning from mistakes! ┗━━━┛
🧠 Learnings used
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/- The package exports framework-agnostic classes (
Okay, I found an issue - hopefully my fix was correct. The build is putting the files in sub-directories within the
distdirectory as a result of bundling solid. I just updated thepackage.jsonto match the new location, which I hope should let the code run correctly now. I'll need an approval to kick off the CI again to be sure. The types are not in sub-directories though and I don't know whether it's okay that the types no longer live alongside the compiled code. Are there any other packages getting bundled anywhere that we can look to for reference?birkskyum(GitHub profile, opens in a new tab) changed the title
birkskyum(GitHub profile, opens in a new tab) closed this
I remember there was a bug reported about something that couldn't find solid, that made us move the solid package to dependency which resolved it, so we should make sure that issue doest reappear
We are so back
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/app/.output/server/node_modules/@tanstack/router-devtools-core/dist/esm/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/web/dist/web.js' imported from /app/.output/server/node_modules/@tanstack/router-devtools-core/dist/esm/packages/router-devtools-core/src/TanStackRouterDevtoolsCore.js at finalizeResolution (node:internal/modules/esm/resolve:274:11) ... 6 lines matching cause stack trace ... at process.processTicksAndRejections (node:internal/process/task_queues:105:5) { cause: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/app/.output/server/node_modules/@tanstack/router-devtools-core/dist/esm/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/web/dist/web.js' imported from /app/.output/server/node_modules/@tanstack/router-devtools-core/dist/esm/packages/router-devtools-core/src/TanStackRouterDevtoolsCore.js at finalizeResolution (node:internal/modules/esm/resolve:274:11) at moduleResolve (node:internal/modules/esm/resolve:864:10) at defaultResolve (node:internal/modules/esm/resolve:990:11) at #cachedDefaultResolve (node:internal/modules/esm/loader:755:20) at ModuleLoader.resolve (node:internal/modules/esm/loader:732:38) at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:317:38) at #link (node:internal/modules/esm/module_job:208:49) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) { code: 'ERR_MODULE_NOT_FOUND', url: 'file:///app/.output/server/node_modules/@tanstack/router-devtools-core/dist/esm/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/web/dist/web.js' }, status: 500, statusText: undefined, headers: undefined, data: undefined, body: undefined, unhandled: true }with pnpm, nitro-v2, node-server in docker
Well darn. Looks like there's an issue for this: https://github.com/TanStack/router/issues/5391
It's interesting that the issue only occurs in production mode. The docs say:
React Query Devtools are only included in bundles when process.env.NODE_ENV === 'development', so you don't need to worry about excluding them during a production build.
However, it doesn't seem like that's necessarily happening here as users are able to workaround the issue with an
import.meta.env.DEVcheck. Perhaps the built-in check needs to happen in a slightly different place earlier in the process?Those docs are for the query devtools (which successfully bundles solid), not the router devtools. They are similar, but the not quite the same.
@benmccann , I think it's necessary we revert this, due to the breaking error.
Those docs are for the query devtools (which successfully bundles solid), not the router devtools. They are similar, but the not quite the same.
Oops! Yes, thanks for pointing that out. I guess I missed that in my haste of googling for it this morning.
React Query Devtools are only included in bundles when process.env.NODE_ENV === 'development', so you don't need to worry about excluding them during a production build.
I didn't test, but I'd be surprised if this is true because the code checks
process.env.NODE_ENVand in my experience that's a runtime check. I think for it to actually take effect at build time it needs to checkimport.meta.envI think it's necessary we revert this, due to the breaking error.
Yeah, that's probably the most expedient route.
I was able to reproduce the issue locally by creating a new project and setting:
"pnpm": { "overrides": { "@tanstack/router-devtools-core": "file:../router/packages/router-devtools-core" } }as well as
nitroV2Plugin({ preset: 'node-server' })in thevite.config.jsBut I'm afraid I have to run for now. Please go ahead and revert it or I can try later. I do wonder if the starter should include the devtools only when in dev mode
Sign in to join this conversation.
Walkthrough#
Moved
solid-jsfromdependenciesandpeerDependenciesintodevDependenciesinpackages/router-devtools-core/package.json, and updated package public entry points/exports to point to./dist/.../packages/router-devtools-core/src/*for both CJS and ESM.Changes#
packages/router-devtools-core/package.jsonsolid-jsfromdependenciesandpeerDependencies; addedsolid-jstodevDependencies(^1.9.5).- Updated
mainandmodulefields andexportsdefaults to./dist/cjs/packages/router-devtools-core/src/index.cjsand./dist/esm/packages/router-devtools-core/src/index.jsrespectively (replacing top-level./dist/*/index.*).Estimated code review effort#
🎯 1 (Trivial) | ⏱️ ~2 minutes
Suggested labels#
package: router-corePoem#
Pre-merge checks and finishing touches#
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share