Skip to content

Bug: @tanstack/react-ai-devtools SSR build fails with solid-js import errors on TanStack Start + Cloudflare Workers #333

@tecoad

Description

@tecoad

Describe the bug

Importing aiDevtoolsPlugin from @tanstack/react-ai-devtools in a TanStack Start app deployed to Cloudflare Workers causes the Vite SSR build to fail. The @tanstack/ai-devtools-core and @tanstack/devtools-utils packages import symbols from solid-js/web that don't exist in the server distribution (solid-js/web/dist/server.js), breaking SSR dependency optimization.

Your minimal, reproducible example

In src/routes/__root.tsx:

import { aiDevtoolsPlugin } from "@tanstack/react-ai-devtools"

// ...used inside the root component:
<TanStackDevtools
  config={{ position: "bottom-right" }}
  eventBusConfig={{ connectToServerBus: true }}
  plugins={[aiDevtoolsPlugin()]}
/>

vite.config.ts:

import { defineConfig } from "vite"
import { devtools } from "@tanstack/devtools-vite"
import { tanstackStart } from "@tanstack/react-start/plugin/vite"
import viteReact from "@vitejs/plugin-react"
import viteTsConfigPaths from "vite-tsconfig-paths"
import tailwindcss from "@tailwindcss/vite"
import { cloudflare } from "@cloudflare/vite-plugin"

export default defineConfig({
  plugins: [
    cloudflare({ viteEnvironment: { name: "ssr" } }),
    devtools({ eventBusConfig: { port: 0 } }),
    viteTsConfigPaths({ projects: ["./tsconfig.json"] }),
    tailwindcss(),
    tanstackStart(),
    viteReact(),
  ],
})

Steps to reproduce

  1. Create a TanStack Start project with Cloudflare Workers deployment (@cloudflare/vite-plugin)
  2. Install @tanstack/react-ai-devtools and @tanstack/react-devtools
  3. Import and use aiDevtoolsPlugin() in the root route
  4. Run bun dev (or any Vite dev/build command)

Expected behavior

The AI devtools plugin should either:

  • Work correctly with SSR / Cloudflare Workers, or
  • Be tree-shaken / excluded from the SSR bundle since devtools are client-only

How often does this happen?

Every time — 100% reproducible on bun dev.

Full error output

✘ [ERROR] No matching export in "node_modules/solid-js/web/dist/server.js" for import "use"

    node_modules/@tanstack/devtools-utils/dist/solid/esm/dev.js:1:34:
      1 │ import { createComponent, insert, use, template } from 'solid-js/web';
        ╵                                   ~~~

✘ [ERROR] No matching export in "node_modules/solid-js/web/dist/server.js" for import "setStyleProperty"

    node_modules/@tanstack/ai-devtools-core/dist/esm/components/list/ConversationRow.js:1:77:
      1 │ ...t { template, insert, createComponent, effect, className, setAttribute, setStyleProperty, delegateEvents } from "solid-js/web";
        ╵                                                                            ~~~~~~~~~~~~~~~~

✘ [ERROR] No matching export in "node_modules/solid-js/web/dist/server.js" for import "setStyleProperty"

    node_modules/@tanstack/ai-devtools-core/dist/esm/components/conversation/ChunkItem.js:1:69:
      1 │ ...mplate, insert, createComponent, effect, className, memo, setStyleProperty, setAttribute, delegateEvents } from "solid-js/web";
        ╵                                                              ~~~~~~~~~~~~~~~~

✘ [ERROR] No matching export in "node_modules/solid-js/web/dist/server.js" for import "setStyleProperty"

    node_modules/@tanstack/ai-devtools-core/dist/esm/components/Shell.js:1:63:
      1 │ import { createComponent, template, insert, effect, className, setStyleProperty, delegateEvents } from "solid-js/web";
        ╵                                                                ~~~~~~~~~~~~~~~~

Error: The file does not exist at "/path/node_modules/.vite/deps_ssr/@tanstack_react-ai-devtools.js"
which is in the optimize deps directory. The dependency might be incompatible with the dep optimizer.
Try adding it to `optimizeDeps.exclude`.

Platform

  • Framework: TanStack Start v1.166.2
  • Deployment target: Cloudflare Workers (@cloudflare/vite-plugin v1.25.6)
  • Vite: v7.3.1
  • Runtime: Bun 1.2.23 / Node 22.20.0
  • OS: macOS (Darwin 24.3.0)

Package versions

Package Version
@tanstack/react-ai-devtools 0.2.10
@tanstack/ai-devtools-core 0.3.6
@tanstack/devtools-utils 0.3.1
@tanstack/react-devtools 0.9.9
@tanstack/devtools-vite 0.5.3
@tanstack/ai 0.6.1
@tanstack/ai-react 0.6.1
solid-js 1.9.11

Workaround

Currently the only workaround is to not use aiDevtoolsPlugin() when deploying to Cloudflare Workers / any SSR environment.

Related issues

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