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 comments in __root.tsx can cause vite plugin issue #3121

Open
NickR49 opened this issue Jan 8, 2025 · 0 comments
Open

Code comments in __root.tsx can cause vite plugin issue #3121

NickR49 opened this issue Jan 8, 2025 · 0 comments
Labels
start Everything about TanStack Start

Comments

@NickR49
Copy link

NickR49 commented Jan 8, 2025

Which project does this relate to?

Start

Describe the bug

Having code comments in __root.tsx as per the below StackBlitz reproduction can cause this error -

503 Server Unavailable

Error: We detected that the '@vitejs/plugin-react' was passed before '@tanstack/start-vite-plugin'. Please make sure that '@tanstack/router-vite-plugin' is passed before '@vitejs/plugin-react' and try again: 
e.g.

plugins: [
  TanStackStartVite(), // Place this before viteReact()
  viteReact(),
]

    at TransformPluginContext.transform (file:///home/projects/tanstack-router-muerds5c/node_modules/@tanstack/start-vite-plugin/dist/esm/index.js:49:15)
    at EnvironmentPluginContainer.transform (file:///home/projects/tanstack-router-muerds5c/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:47285:19)
    at async loadAndTransform (file:///home/projects/tanstack-router-muerds5c/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:41095:27)
    at async fetchModule (file:///home/projects/tanstack-router-muerds5c/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:51548:16)
    at async handleInvoke (file:///home/projects/tanstack-router-muerds5c/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:44227:22)
    at async EventEmitter.listenerForInvokeHandler (file:///home/projects/tanstack-router-muerds5c/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:44300:19)

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-xi2evreq?file=app%2Froutes%2F__root.tsx&preset=node

Steps to Reproduce the Bug or Issue

  1. Go to the above StackBlitz
  2. In __root.tsx remove the space in // createServer Fn to recreate the error
  3. Alternatively, removing Temporary hack to fix HMR comment further below also makes the error go away

Expected behavior

As a user I was expecting not to have errors caused by comments in __root.tsx

Screenshots or Videos

No response

Platform

  • MacOS 15.2
  • Chrome 131, Opera 114
  • TanStack Router/Start 1.94.1

Additional context

No response

@SeanCassiere SeanCassiere added bug Something isn't working start Everything about TanStack Start and removed bug Something isn't working labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
start Everything about TanStack Start
Projects
None yet
Development

No branches or pull requests

2 participants