Skip to content

[bug]: Tanstack Router Template broken #8554

@jkinley

Description

@jkinley

Describe the bug

The shadcn ts router installer is installing nitro plugin, which breaks the ts router build. The nitro stuff is for ts start not router. Here is what the installer has in the vite config. Also, why is install demo still showing @canary?

import { defineConfig } from 'vite'
import viteReact from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'

import { tanstackRouter } from '@tanstack/router-plugin/vite'
import { fileURLToPath, URL } from 'node:url'
import { nitroV2Plugin } from '@tanstack/nitro-v2-vite-plugin'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    nitroV2Plugin(),
    tanstackRouter({
      target: 'react',
      autoCodeSplitting: true,
    }),
    viteReact(),
    tailwindcss(),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
})

Affected component/components

No components are affected

How to reproduce

https://ui.shadcn.com/docs/installation/tanstack-router

if you follow these docs, then you will see the issue.

Codesandbox/StackBlitz link

No response

Logs

Last login: Wed Oct 22 08:07:36 on ttys016
jeff5053@C02FL161MD6R ~ % cd Desktop 
jeff5053@C02FL161MD6R Desktop % mkdir test
jeff5053@C02FL161MD6R Desktop % cd test
jeff5053@C02FL161MD6R test % pnpm dlx create-tsrouter-app@latest my-app --template file-router --tailwind --add-ons shadcn
Packages: +332
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 399, reused 315, downloaded 17, added 332, done
┌  Creating a new TanStack app in my-app...
│
◇  Initialized git repository
│
◇  Installed dependencies
│
└  Your TanStack app is ready in 'my-app'.

Use the following commands to start your app:
% cd my-app
% pnpm dev

Please check the README.md for information on testing, styling, adding routes, etc.

jeff5053@C02FL161MD6R test % cd my-app 
jeff5053@C02FL161MD6R my-app % ls
components.json	node_modules	pnpm-lock.yaml	README.md	tsconfig.json
index.html	package.json	public		src		vite.config.ts
jeff5053@C02FL161MD6R my-app % pnpm build

> my-app@ build /Users/jeff5053/Desktop/my-app
> vite build && tsc

vite v7.1.12 building for production...
✓ 1813 modules transformed.
dist/index.html                     0.71 kB │ gzip:  0.40 kB
dist/assets/logo-CuCXCxLu.svg      19.29 kB │ gzip:  8.87 kB
dist/assets/index-DSJxhP3x.css     15.09 kB │ gzip:  3.84 kB
dist/assets/index-B0okM_9K.js       0.83 kB │ gzip:  0.47 kB
dist/assets/YRFZDV5N-CPQ0P1R9.js  132.55 kB │ gzip: 45.33 kB
dist/assets/index-BKoXS5MF.js     309.04 kB │ gzip: 99.35 kB
✓ built in 2.56s
vite v7.1.12 building SSR bundle for production...
error during build:
rollupOptions.input should not be an html file when building for SSR. Please specify a dedicated SSR entry.
    at resolveRollupOptions (file:///Users/jeff5053/Desktop/my-app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:33682:73)
    at buildEnvironment (file:///Users/jeff5053/Desktop/my-app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:33737:25)
    at Object.build (file:///Users/jeff5053/Desktop/my-app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:34129:25)
    at Object.buildApp (file:///Users/jeff5053/Desktop/my-app/node_modules/.pnpm/@[email protected][email protected]_@[email protected][email protected]_lightning_ufh6arf65lfhs5c673wua4k3ma/node_modules/@tanstack/nitro-v2-vite-plugin/dist/esm/index.js:80:29)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Object.buildApp (file:///Users/jeff5053/Desktop/my-app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:34125:38)
    at async CAC.<anonymous> (file:///Users/jeff5053/Desktop/my-app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/cli.js:629:3)
 ELIFECYCLE  Command failed with exit code 1.
jeff5053@C02FL161MD6R my-app %

System Info

MacOS

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions