TanStack / TanStack/devtools

devtools-ui 0.7.0 breaks SSR boot with solid-js <=1.9.12: `use` is not exported by solid-js/web server build

未关闭 适合新手
#511 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
499
派生
100
平均合并
1 天 17 小时
30 天内合并 PR
4

描述

TanStack Devtools version

@tanstack/devtools 0.14.0 / @tanstack/devtools-ui 0.7.0 (still present in 0.14.1 / 0.7.1, the latest at time of filing)

Framework/Library version

TanStack Start (@tanstack/react-start 1.168.x) + Vite 8 (rolldown) + @cloudflare/vite-plugin, solid-js 1.9.12 in the lockfile

Describe the bug

Upgrading @tanstack/devtools 0.13.0 → 0.14.0 (which bumps the bundled @tanstack/devtools-ui 0.6.0 → 0.7.0) makes vite dev fail to boot in any app whose SSR environment processes devtools, when the resolved solid-js is ≤ 1.9.12:

Error: Error during dependency optimization:

[MISSING_EXPORT] "use" is not exported by "node_modules/solid-js/web/dist/server.js".
   ╭─[ node_modules/@tanstack/devtools/node_modules/@tanstack/devtools-ui/dist/esm/components/theme.js:2:45 ]
   │
 2 │ import { createComponent, insert, template, use } from "solid-js/web";
   │                                             ─┬─
   │                                              ╰─── Missing export

The dev server never starts, which also takes down every Playwright run driven by vite dev.

Root cause
  • @tanstack/devtools-ui 0.7.0 (PR #492, commit a46d1f5) wrapped ThemeContextProvider's children in <span style="display:contents" ref={setContainer}> so it can call ensureDevtoolsStyles(element.ownerDocument) (src/components/theme.tsx). The Solid compiler emits that ref as use(setContainer, _el$), so the published ESM (dist/esm/components/theme.js) now imports use from solid-js/web. In 0.6.0 that file imported only createComponent.
  • Under the node/SSR export condition, solid-js/web resolves to web/dist/server.js. That server build exported no use at all through solid-js 1.9.12; solid-js 1.9.13 (2026-05-15) added it as a notSup stub (notSup as use).
  • @tanstack/devtools-ui declares solid-js: >=1.9.7 (and @tanstack/devtools depends on ^1.9.9), so resolvers happily keep ≤ 1.9.12 in existing lockfiles — a lockfile that worked with devtools 0.13.0 hard-fails right after the bump.

Client-only setups never hit it (the browser build has always exported use), which is presumably why it shipped unnoticed. It surfaces wherever the SSR side bundles or import-validates devtools — e.g. TanStack Start with rolldown-vite's SSR dependency optimizer.

Steps to reproduce
  1. Lockfile with solid-js@1.9.12 (any version ≥1.9.7 and ≤1.9.12 works) and @tanstack/devtools@0.14.x.
  2. Import devtools in an app whose Vite SSR environment processes it (TanStack Start default setup is enough).
  3. vite devMISSING_EXPORT "use" during SSR dependency optimization.

Or minimally, in any Node ESM context resolving the server condition:

import { use } from 'solid-js/web'; // solid-js@1.9.12, server condition → SyntaxError/MISSING_EXPORT
Suggested fix

Raise the solid-js floor to ^1.9.13 in @tanstack/devtools-ui's (and @tanstack/devtools's) dependency ranges, so resolvers pull a solid-js whose server build has the use stub. Alternatively avoid the refuse emission in output that gets loaded under the server condition.

Workaround for affected users: force-dedupe solid-js to ≥ 1.9.13 (we removed the stale nested resolutions from the lockfile so a single hoisted 1.9.15 serves everything; that fixes the boot).

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 src/components/theme.tsx 开始,使用 solid-js 1.9.12 以及 issue 中描述的最小服务器条件 import,重现 SSR 依赖优化失败的问题。解决已发布 package 的兼容性问题,然后验证在使用受影响依赖范围的 SSR 设置中 vite dev 能够启动,并且不再出现缺少导出的错误。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript, vite
领域
tooling
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
描述清楚
新手友好度
75/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。