Skip to content

router-cli 1.141.7 favors lazy over regular routes #6142

@qodesmith

Description

@qodesmith

Which project does this relate to?

Router

Describe the bug

I upgraded @tanstack/router-cli from ^1.141.2 => ^1.141.7

This made drastic changes to my routeTree.gen.ts file, namely it changed importing regular routes to importing their lazy variants. For example:

// BEFORE
const DashboardIndexLazyRoute = DashboardIndexLazyRouteImport.update({
  id: '/',
  path: '/',
  getParentRoute: () => DashboardRouteRoute,
} as any).lazy(() =>
  import('./routes/dashboard/index.lazy').then((d) => d.Route),
)

// AFTER
const DashboardIndexLazyRoute = DashboardIndexLazyRouteImport.update({
  id: '/',
  path: '/',
  getParentRoute: () => DashboardRouteLazyRoute,
} as any).lazy(() =>
  import('./routes/dashboard/index.lazy').then((d) => d.Route),
)

No routes are found now, presumable because it's trying to load the lazy file before it loads the regular file.

Your Example Website or App

Steps to Reproduce the Bug or Issue

// BEFORE
const DashboardIndexLazyRoute = DashboardIndexLazyRouteImport.update({
  id: '/',
  path: '/',
  getParentRoute: () => DashboardRouteRoute,
} as any).lazy(() =>
  import('./routes/dashboard/index.lazy').then((d) => d.Route),
)

// AFTER
const DashboardIndexLazyRoute = DashboardIndexLazyRouteImport.update({
  id: '/',
  path: '/',
  getParentRoute: () => DashboardRouteLazyRoute,
} as any).lazy(() =>
  import('./routes/dashboard/index.lazy').then((d) => d.Route),
)

Expected behavior

Lazy routes should not loaded before regular routes.

Screenshots or Videos

No response

Platform

  • Router / Start Version: [e.g. 1.121.0]
  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Browser Version: [e.g. 91.1]
  • Bundler: [e.g. vite]
  • Bundler Version: [e.g. 7.0.0]

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions