Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Splitting Issues with TanStack Start and Cloudflare Pages Deployment (Side Effect) #3433

Open
sarabenchinoun opened this issue Feb 14, 2025 · 4 comments

Comments

@sarabenchinoun
Copy link

sarabenchinoun commented Feb 14, 2025

Which project does this relate to?

Start

Describe the bug

I'm experiencing issues with code splitting when deploying a TanStack Start project to Cloudflare Pages. The application appears to be splitting code in a way that breaks functionality or causes errors after deployment, even though it works correctly in development.

Your Example Website or App

https://codesandbox.io/p/github/sarabenchinoun/start-basic/draft/muddy-platform

Steps to Reproduce the Bug or Issue

  1. Open the link: https://codesandbox.io/p/github/sarabenchinoun/start-basic/draft/muddy-platform
  2. Install dependencies: pnpm i
  3. Run the build: pnpm build
  4. Preview the build with Cloudflare: pnpm preview

Expected behavior

The deployed application on Cloudflare Pages should be successful and behave identically to the application running in development mode. Code splitting should be handled correctly, and all routes and components should function as expected.

Screenshots or Videos

Image

Platform

  • Operating System: macOS
  • Node.js version: v22
  • pnpm version: 9.15.4
  • wrangler version: "3.109.0"
  • TanStack Start version: "1.104.2"
  • Browser: Firefox

Additional context

This issue occurs even in a new project, so it doesn't seem to be related to my project's specific code.

  • This issue was reproduced in a fresh TanStack Start project.
  • The project uses pnpm as the package manager.
  • I suspect the problem is related to how TanStack Start's code splitting interacts with Cloudflare Pages' build and deployment process.
@stiks
Copy link

stiks commented Feb 17, 2025

Have same issue

@Yaoshiko
Copy link

Me too. I had the same warnings with a working repo, and I don't with a broken repo, so I don't think that's the issue.
I opened a thread and created a minimal repo to reproduce it: pnpm preview in master works, in bug-cf-deployment doesn't. It seems that it happens since version 1.82.

@scobbe
Copy link

scobbe commented Feb 18, 2025

After version update, when I run vinxi build --preset cloudflare-pages now it has suddenly started hanging on me following the build log message Built your router client successfully (perhaps related to defineConfig now returning a Promise)?

@afkcodes
Copy link

I am not able to deploy and get this

✘ [ERROR] Deployment failed!

  Failed to publish your Function. Got error: Uncaught Error: No such module "node:http".
    imported from "chunks/nitro/nitro.mjs"```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants