Skip to content

Tanstack start not building SSR bundle for production #91

Closed

Description

@Sipixer

TanStack Devtools version

v0.5.4

Framework/Library version

React 19.1.0

Describe the bug and the steps to reproduce it

When attempting to build the React "start" example using:

vite build && tsc --noEmit

the build fails with an error related to solid-js/web.

It seems the Devtools package includes precompiled Solid components in the core build, which causes issues in React projects.

A temporary workaround—marking Solid as external in vite.config.ts—works only when building directly from the source repository:

build: {
  rollupOptions: {
    external: ['solid-js', 'solid-js/web'],
  },
},

However, this workaround does not work when installing the package via pnpm in an external project, because the precompiled ESM already contains Solid imports. As a result, React projects cannot build the package without having Solid installed, which should not be required.


Error Output

✓ built in 7.66s
vite v7.0.6 building SSR bundle for production...
✓ 195 modules transformed.
✗ Build failed in 958ms
error during build:
../../../packages/devtools/dist/esm/components/content-panel.js (1:19): "use" is not exported by "../../../node_modules/.pnpm/solid-js@1.9.7/node_modules/solid-js/web/dist/server.js", imported by "../../../packages/devtools/dist/esm/components/content-panel.js".
file: C:/Users/Sylvain/Desktop/dev/devtools/packages/devtools/dist/esm/components/content-panel.js:1:19

1: import { template, use, insert, memo, addEventListener, effect, className, delegateEvents } from "solid-js/web";
                      ^
2: import { useDevtoolsSettings } from "../context/use-devtools-context.js";
3: import { useStyles } from "../styles/use-styles.js";

    at getRollupError (...)
    at error (...)
    at Module.error (...)
    ...

Steps to Reproduce

  1. Clone this repo
  2. Run pnpm i
  3. Run pnpm dev
  4. Navigate to cd .\examples\react\start\
  5. Run:
    vite build && tsc --noEmit

Current Behavior

  • Build fails due to solid-js/web import ("use" not exported).

Expected Behavior

  • The project should build successfully without requiring Solid to be marked as external in Vite config.

Additional Notes

I am trying to better understand how Vite’s Rollup integration and the devtools package work in order to investigate further, but I’m not sure if I’ll be able to fully resolve this issue on my own.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

this repo

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

No, because I do not know how

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Activity

  1. sprusak commented on Sep 5, 2025

    @sprusak
    Contributor

    I've tried to dig into this issue, and looks like devtools package relies on some client only features from solid-js, that are not exported from @solid-js/web via server build. Just looking at @solid-js/web package.json I can see this mapping:

    "browser": {
            "development": {
              "types": "./types/index.d.ts",
              "import": "./dist/dev.js",
              "require": "./dist/dev.cjs"
            },
            "types": "./types/index.d.ts",
            "import": "./dist/web.js",
            "require": "./dist/web.cjs"
          },
          "deno": {
            "types": "./types/index.d.ts",
            "import": "./dist/server.js",
            "require": "./dist/server.cjs"
          },
          "node": {
            "types": "./types/index.d.ts",
            "import": "./dist/server.js",
            "require": "./dist/server.cjs"
          },
    

    Which means that ssr build will resolve @solid-js/web to ./dist/server.js instead of ./dist/web.js.

    One solution that I see is to provide a dedicated build for the server, that won't do anything (devtools are rendered on client anyway) or try to figure out which exact features of solid-js causes this issue, as this happens only while using @tanstack/react-devtools and this issue does not happen for eg. @tanstack/react-query-devtools

  2. sprusak commented on Sep 5, 2025

    @sprusak
    Contributor

    @AlemTuzlak I prepared a PR please check if this fix makes sense #109

  3. AlemTuzlak commented on Sep 5, 2025

    @AlemTuzlak
    Collaborator

    Wow, thank you so much for this, I finally understand what the issue is! I'll test it out right away

  4. AlemTuzlak commented on Sep 5, 2025

    @AlemTuzlak
    Collaborator

    Fixed with #109

  5. Asjas commented on Oct 9, 2025

    @Asjas

    This appears to have broken again in @tanstack/react-router-devtools version 1.132.51. Downgrading to 1.132.50 works.

  6. tsteckenborn commented on Nov 24, 2025

    @tsteckenborn

    Having a similar issue (I suppose) with

    "@tanstack/devtools-vite": "0.3.11",
    "@tanstack/react-devtools": "0.8.1",
    
    [1] Error: Error during dependency optimization:
    [1] 
    [1] ✘ [ERROR] No matching export in "../../node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/web/dist/server.js" for import "use"
    [1] 
    [1]     ../../node_modules/.pnpm/@tanstack+devtools-utils@0.0.4_@types+react@19.2.7_csstype@3.2.3_react@19.2.0_solid-js@1.9.5/node_modules/@tanstack/devtools-utils/dist/solid/esm/dev.js:1:44:
    [1]       1 │ import { createComponent, template, insert, use } from 'solid-js/web';
    [1]         ╵                                         
    
  7. KurtJHC commented on Dec 11, 2025

    @KurtJHC

    also broken with react-form-devtools

    Error: Error during dependency optimization:
    
    ✘ [ERROR] No matching export in "node_modules/.pnpm/solid-js@1.9.10/node_modules/solid-js/web/dist/server.js" for import "use"
    
        node_modules/.pnpm/@tanstack+devtools-utils@0.0.9_@types+react@19.2.7_csstype@3.2.3_react@19.2.1_solid-js@1.9.10/node_modules/@tanstack/devtools-utils/dist/solid/esm/dev.js:1:44:
          1 │ import { createComponent, template, insert, use } from 'solid-js/web';
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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