Skip to content

static pre-rendering does not pre-render pages that are not linked #5455

Closed

Description

@FatahChan

Which project does this relate to?

Start

Describe the bug

I have enabled pre-render.

    tanstackStart({
      prerender:{
        enabled: true,
      }
    }),

I have the following routes

  • index.tsx
  • test1.tsx
  • test2.tsx

index route has a link to test2 route.

I expect that all routes to be pre-rendered.

actual
only index, and test2 are pre-rendered.

Image

Either this a bug in the code, or the documentation is not clear

https://tanstack.com/start/latest/docs/framework/react/guide/static-prerendering

according to the documentation, that if we don't specify a specify route to be re-rendered all routes will be prerenderd

Image

Your Example Website or App

https://github.com/FatahChan/start-basic-prerender

Steps to Reproduce the Bug or Issue

run pnpm build

output would be

Image

Expected behavior

test1 should also be pre-rendered, even it's not linked in the home page

Screenshots or Videos

No response

Platform

"@tanstack/react-router": "^1.132.47",
"@tanstack/react-start": "^1.132.53",
"@vitejs/plugin-react": "^5.0.4",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"vite": "^7.1.9"

Additional context

No response

Activity

  1. FatahChan commented on Oct 12, 2025

    @FatahChan
    ContributorAuthor

    according the comment here, only the root path is pre-rendered.
    https://github.com/TanStack/router/blob/main/packages/start-plugin-core/src/prerender.ts#L24

    which mean the documentation is is incorrect.

    however, I personally expect that all routes to be pre-rendered if, if no pages are specified, coming from Nextjs that would be the default behaviour

  2. schiller-manuel commented on Oct 12, 2025

    @schiller-manuel
    Collaborator

    we could only prerender static paths though, since dynamic paths require path params

    we don't do that but could add this

  3. FatahChan commented on Oct 12, 2025

    @FatahChan
    ContributorAuthor

    we could only prerender static paths though, since dynamic paths require path params

    we don't do that but could add this

    wdym by dynamic paths?

    both test1 and test2 are static paths

  4. schiller-manuel commented on Oct 12, 2025

    @schiller-manuel
    Collaborator

    in your example, yes. but as soon as you add $param we can't prerender

  5. FatahChan commented on Oct 12, 2025

    @FatahChan
    ContributorAuthor

    in your example, yes. but as soon as you add $param we can't prerender

    yes, I understand, my issue is that it wasn't documented properly, and was very confused.

    for now, I think that the next course of actions, is to pre-render add static routes if user did not specify pages, and improve the documentation to inform devs that dynamic paths are not pre-rendered.

    in the future, maybe something like getStaticPaths can be implemented

  6. schiller-manuel commented on Oct 12, 2025

    @schiller-manuel
    Collaborator

    yes, we want to add something like getStaticPaths in the future

  7. FatahChan commented on Oct 12, 2025

    @FatahChan
    ContributorAuthor

    yes, we want to add something like getStaticPaths in the future

    I am working on pr to fix my issue

  8. nyomansunima commented on Oct 13, 2025

    @nyomansunima

    Yeah, that's a good solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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