workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

[Tanstack Start] Tanstack Start has updated to use vite directly; Workers integration no longer functional

Open astralarya opened this issue 5 months ago • 0 comments

What versions & operating system are you using?

wrangler 4.20.0, MacOS Sequoia 15.5

Please provide a link to a minimal reproduction

https://github.com/astralarya/tanstack-start-basic-cloudflare

This is an attempt to update the Tanstack Start basic example to include the Cloudflare Vite plugin: https://github.com/TanStack/router/tree/main/examples/react/start-basic

The only changes from the basic example are package.json, vite.config.ts, and wrangler.jsonc.

Describe the Bug

The method here to integrate Workers with Tanstack Start no longer works: https://developers.cloudflare.com/workers/framework-guides/web-apps/tanstack/

This is because Tanstack no longer uses vinxi and instead uses vite directly.

Please provide any relevant error logs

After adding the Cloudflare vite plugin to the vite config in the Tanstack Start basic example, I get the following errors when running vite dev:

% npm run dev                                

> dev
> vite dev

Generated route tree in 94ms

  VITE v6.3.5  ready in 981 ms

  ➜  Local:   http://localhost:3000/
  ➜  Network: use --host to expose
  ➜  Debug:   http://localhost:3000/__debug
  ➜  press h + enter to show help
✘ [ERROR] Could not resolve "tanstack-start-route-tree:v"

    node_modules/.pnpm/@[email protected]/node_modules/@tanstack/start-server-core/dist/esm/loadVirtualModule.js:5:26:
      5 │       return await import("tanstack-start-route-tree:v");
        ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "tanstack-start-route-tree:v" as external to exclude it from the bundle,
  which will remove this error and leave the unresolved path in the bundle. You can also add
  ".catch()" here to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "tanstack-start-manifest:v"

    node_modules/.pnpm/@[email protected]/node_modules/@tanstack/start-server-core/dist/esm/loadVirtualModule.js:7:26:
      7 │       return await import("tanstack-start-manifest:v");
        ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "tanstack-start-manifest:v" as external to exclude it from the bundle, which
  will remove this error and leave the unresolved path in the bundle. You can also add ".catch()"
  here to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "tanstack-start-server-fn-manifest:v"

    node_modules/.pnpm/@[email protected]/node_modules/@tanstack/start-server-core/dist/esm/loadVirtualModule.js:9:26:
      9 │       return await import("tanstack-start-server-fn-manifest:v");
        ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "tanstack-start-server-fn-manifest:v" as external to exclude it from the
  bundle, which will remove this error and leave the unresolved path in the bundle. You can also add
  ".catch()" here to handle this failure at run-time instead of bundle-time.

/Users/marakim/Documents/code/github/temp/start-basic/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1463
  let error = new Error(text);
              ^

Error: Build failed with 3 errors:
node_modules/.pnpm/@[email protected]/node_modules/@tanstack/start-server-core/dist/esm/loadVirtualModule.js:5:26: ERROR: Could not resolve "tanstack-start-route-tree:v"
node_modules/.pnpm/@[email protected]/node_modules/@tanstack/start-server-core/dist/esm/loadVirtualModule.js:7:26: ERROR: Could not resolve "tanstack-start-manifest:v"
node_modules/.pnpm/@[email protected]/node_modules/@tanstack/start-server-core/dist/esm/loadVirtualModule.js:9:26: ERROR: Could not resolve "tanstack-start-server-fn-manifest:v"
    at failureErrorWithLog (/Users/marakim/Documents/code/github/temp/start-basic/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1463:15)
    at /Users/marakim/Documents/code/github/temp/start-basic/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:924:25
    at /Users/marakim/Documents/code/github/temp/start-basic/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1341:9
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Node.js v22.9.0

Commenting out the cloudflare() plugin from vite.config.ts resolves these errors.

astralarya avatar Jun 16 '25 23:06 astralarya