Skip to content

@tanstack/router-cli@1.166.35 generate fails with newest 1.66.36 version #7275

@codeart1st

Description

@codeart1st

Which project does this relate to?

Router

Describe the bug

We use @tanstack/router-cli generate in our library project to generate the types without calling vite. Since last weekend the job fails:

> npx -y @tanstack/router-cli@1.166.36 generate

Error: Cannot find module '@/constants'
Require stack:
- /home/[...]/routes.config.ts
    at /home/[...]/.npm/_npx/b068e050d756338e/node_modules/@tanstack/router-generator/dist/cjs/generator.cjs:131:13
    at async Object.generate (/home/[...]/.npm/_npx/b068e050d756338e/node_modules/@tanstack/router-cli/dist/cjs/generate.cjs:6:3)
    at async /home/[...]/.npm/_npx/b068e050d756338e/node_modules/@tanstack/router-cli/dist/cjs/index.cjs:13:3

The problem occurs since 1.166.36.

Your Example Website or App

https://stackblitz.com/edit/github-2bhm9xj2?file=package.json

Steps to Reproduce the Bug or Issue

  • npm run types:tanstack -> fails
  • switch to version 1.166.35
  • npm run types:tanstack -> succeded

routes.config.ts:

import {
  // ...
} from '@/constants'
import { rootRoute, index, route, layout } from '@tanstack/virtual-file-routes'

export default rootRoute('app/routes/root.ts', [
  // ...
])

tsconfig.json

  "compilerOptions": {
    "paths": {
      "@/*": [
        "./lib/*"
      ]
    }
  },

Expected behavior

@tanstack/router-cli@1.166.36 works the same as @tanstack/router-cli@1.166.35.

Screenshots or Videos

No response

Platform

  • Bundler: vite
  • Bundler Version: 8.0.8
  • TypeScript: 5.9.3

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions