Skip to content
Source
Sign inSign up
TanStack/router

Start 1.142.2 + Bun leaks `node:*` modules in build for client #6169

Send to my agent
Closedkylekz(GitHub profile, opens in a new tab) opened this issue 4 comments

Which project does this relate to?

Start

Describe the bug

upgrading @tanstack/react-start to anything above 1.142.1 results in node:* modules leaking to the client and the build failing. title might not be accurate but it's all i could think of

bun + vite 8: https://gist.github.com/kylekz/3e85b56a25c37fef59b5445e23e7ceca bun + vite 7.3: https://gist.github.com/kylekz/457b93257e7ef2c811cc725085996bb3 pnpm/node + vite 7.3: https://gist.github.com/kylekz/230b053d68911f8be81d8b25866d3953

i haven't been able to create a reproduction, but my actual repo is available: https://github.com/teamreflex/cosmo-web/tree/refactor/tanstack-start-vite-error refactor/tanstack-start contains bun + vite 8.0.0-beta.3 + start 1.142.1 and is working refactor/tanstack-start-vite-error contains bun + vite 7.3.0 + start 1.142.2 and is not working

the app uses bun runtime features so switching back to node isn't really an option. the app won't run with the env provided here but it'll get it past env validation in build. using bun 1.3.5.

Your Example Website or App

https://github.com/teamreflex/cosmo-web

Steps to Reproduce the Bug or Issue

git clone git@github.com:teamreflex/cosmo-web.git
cd cosmo-web
git checkout refactor/tanstack-start-vite-error
bun install
curl https://gist.githubusercontent.com/kylekz/a8afdc64513871b2791cd761c748e30c/raw/919bfacf8fd1532234f884f004651912d7031b1c/gistfile1.txt -o .env
turbo build --filter web

Expected behavior

build should succeed like 1.142.1 does

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.142.2
  • OS: Linux
  • Browser: Chrome
  • Browser Version: 143.0.7499.147
  • Bundler: vite
  • Bundler Version: 8.0.0-beta.3

Additional context

No response

  1. 📝 CodeRabbit Plan Mode

    Generate an implementation plan and prompts that you can use with your favorite coding agent.

    • Create Plan
    Examples

    🔗 Similar Issues

    Possible Duplicates

    Related Issues

    🔗 Related PRs
  2. TanStack/router#5284 - tests(start): update spa mode e2e to use production build [merged] TanStack/router#5408 - fix(start-plugin-core): Properly declare start-client-core in dependencies [merged] TanStack/router#5422 - fix(router-devtools-core): actually bundle solid [merged] TanStack/router#5903 - fix(solid-start): fix hydration regression in 1.136.9 [merged]

    👤 Suggested Assignees


    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord or schedule a call!

  • Hi, I am having the same issue using pnpm and Nitro using @tanstack/react-start:1.142.5. I have to rollback to my previous working version @tanstack/react-start:1.142.0.

    plugin vite:resolve] Module "node:async_hooks" has been externalized for browser compatibility, imported by "/Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/@tanstack+start-storage-context@1.142.1/node_modules/@tanstack/start-storage-context/dist/esm/async-local-storage.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
    ✓ 10700 modules transformed.
    ✗ Build failed in 9.08s
    app:build: error during build:
    app:build: ../../node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js (5:9): "performance" is not exported by "__vite-browser-external", imported by "../../node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js".
    app:build: file: /Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:5:9
    app:build: 
    app:build: 3: import crypto from 'crypto'
    app:build: 4: import Stream from 'stream'
    app:build: 5: import { performance } from 'perf_hooks'
    app:build:             ^
    app:build: 6: 
    app:build: 7: import { stringify, handleValue, arrayParser, arraySerializer } from './types.js'
    app:build: 
    app:build:     at getRollupError (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/parseAst.js:401:41)
    app:build:     at error (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/parseAst.js:397:42)
    app:build:     at Module.error (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:16956:16)
    app:build:     at Module.traceVariable (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:17412:29)
    app:build:     at ModuleScope.findVariable (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:15076:39)
    app:build:     at FunctionScope.findVariable (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:5649:38)
    app:build:     at FunctionBodyScope.findVariable (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:5649:38)
    app:build:     at FunctionScope.findVariable (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:5649:38)
    app:build:     at FunctionBodyScope.findVariable (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:5649:38)
    app:build:     at MemberExpression.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:7363:49)
    app:build:     at CallExpression.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:2813:23)
    app:build:     at CallExpression.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:12123:15)
    app:build:     at BinaryExpression.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:2813:23)
    app:build:     at ConditionalExpression.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:2813:23)
    app:build:     at CallExpression.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:2809:28)
    app:build:     at CallExpression.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:12123:15)
    app:build:     at ExpressionStatement.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:2813:23)
    app:build:     at BlockStatement.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:2809:28)
    app:build:     at FunctionDeclaration.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:2813:23)
    app:build:     at BlockStatement.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:2809:28)
    app:build:     at FunctionDeclaration.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:2813:23)
    app:build:     at Program.bind (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:2809:28)
    app:build:     at Module.bindReferences (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:16935:18)
    app:build:     at Graph.sortModules (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:22746:20)
    app:build:     at Graph.build (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:22644:14)
    app:build:     at async file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:23335:13
    app:build:     at async catchUnfinishedHookActions (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:22805:16)
    app:build:     at async rollupInternal (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/rollup@4.53.3/node_modules/rollup/dist/es/shared/node-entry.js:23330:5)
    app:build:     at async buildEnvironment (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/vite@7.3.0_@types+node@24.10.4_jiti@2.6.1_lightningcss@1.30.2_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/config.js:33540:12)
    app:build:     at async Object.build (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/vite@7.3.0_@types+node@24.10.4_jiti@2.6.1_lightningcss@1.30.2_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/config.js:33899:19)
    app:build:     at async Object.buildApp (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/@tanstack+start-plugin-core@1.142.5_@tanstack+react-router@1.141.8_react-dom@19.2.3_rea_1fa3d846ecfb28e1b29a0f9c0b6a42d9/node_modules/@tanstack/start-plugin-core/dist/esm/plugin.js:257:17)
    app:build:     at async Object.buildApp (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/vite@7.3.0_@types+node@24.10.4_jiti@2.6.1_lightningcss@1.30.2_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/config.js:33891:6)
    app:build:     at async CAC.<anonymous> (file:///Users/jsantosa/Projects/Github/code-flow/node_modules/.pnpm/vite@7.3.0_@types+node@24.10.4_jiti@2.6.1_lightningcss@1.30.2_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/cli.js:629:3)
    app:build:  ELIFECYCLE  Command failed with exit code 1.
    app:build: ERROR: command finished with error: command (/Users/jsantosa/Projects/Github/code-flow/apps/app) /Users/jsantosa/Library/pnpm/.tools/pnpm/10.26.1/bin/pnpm run build exited (1)
    app#build: command (/Users/jsantosa/Projects/Github/code-flow/apps/app) /Users/jsantosa/Library/pnpm/.tools/pnpm/10.26.1/bin/pnpm run build exited (1)
    

    Kind regards

  • Same issue here, with SolidJS + Nitro, for me, it manifested through @libsql/client when running pnpm dev. The browser console prints the following:

    chunk-KPVK6TAY.js?v=dcfdb52d:4715 Uncaught (in promise) LibsqlError: URL_SCHEME_NOT_SUPPORTED: The client that uses Web standard APIs supports only "libsql:", "wss:", "ws:", "https:" and "http:" URLs, got "file:". For more information, please read https://github.com/libsql/libsql-client-ts#supported-urls
        at _createClient3 (chunk-KPVK6TAY.js?v=dcfdb52d:4715:11)
        at createClient (chunk-KPVK6TAY.js?v=dcfdb52d:4707:10)
        at client.ts:11:16
    _createClient3 @ chunk-KPVK6TAY.js?v=dcfdb52d:4715
    createClient @ chunk-KPVK6TAY.js?v=dcfdb52d:4707
    (anonymous) @ client.ts:11
  • Sign in to join this conversation.