TanStack / router

🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering.
https://tanstack.com/router
MIT License
8.34k stars 673 forks source link

TanStack Start development server fails when embedding a Sanity studio #2897

Open alexanbj opened 3 days ago

alexanbj commented 3 days ago

Which project does this relate to?

Start

Describe the bug

Hello,

I'm attempting to embed a Sanity studio in a newly setup TanStack Start app.

I'm followed the TanStack Start getting started guide and Sanity's embedding studio guide. However, an exception is thrown if I navigate to that route when using the development server. I've created a reproduction repo.

The error seems to occur in vite-plugin-tanstack-start-dead-code-elimination. See the full error in the reproduction steps or the reproduction repo.

No error is thrown when building the app for production.

Your Example Website or App

https://github.com/alexanbj/tanstackstart-embedded-sanity-reproduction/tree/main

Steps to Reproduce the Bug or Issue

  1. Create a new TanStack Start app following these instructions https://tanstack.com/router/latest/docs/framework/react/start/getting-started
  2. Create a new route where a Sanity studio is embedded https://www.sanity.io/docs/embedding-sanity-studio
  3. Run the dev server and navigate to that route
  4. It fails with an exception along the lines of
    [vite] Internal server error: Property left of ForOfStatement expected node to be of a type ["VariableDeclaration","LVal"] but instead got undefined
    Plugin: vite-plugin-tanstack-start-dead-code-elimination
    File: /Users/alexanbj/Code/Hacking/tanstackstart-sanity-reproduction/node_modules/.vinxi/cache/client/deps/chunk-XONAPM26.js?v=ffa86631

Expected behavior

Able to embed the Sanity studio in development.

Screenshots or Videos

No response

Platform

Additional context

No response

schiller-manuel commented 23 hours ago

can you please run TSR_VITE_DEBUG=true npm run build and provide the output as a gist?