Skip to content

enableRouteGeneration: false also disables autoCodeSplitting #5087

Closed

Description

@high-risc

Which project does this relate to?

Router

Describe the bug

When using the Vite plugin, if you set enableRouteGeneration: false (for instance if you don't want to generate routes when building since they shouldn't be changing) and autoCodeSplitting: true, then it won't automatically code split the built version.

Your Example Website or App

N/A

Steps to Reproduce the Bug or Issue

  1. Set enableRouteGeneration: false and autoCodeSplitting: true
  2. Build the application and routes won't be split automatically, you need to use .lazy

Expected behavior

I expect to have automatic code splitting regardless of what is set for enableRouteGeneration

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.131.35
  • OS: Windows
  • Browser: N/A
  • Browser Version: N/A
  • Bundler: Vite
  • Bundler Version: 7.1.4

Additional context

No response

Activity

  1. LadyBluenotes commented on Jul 15, 2026

    @LadyBluenotes
    Member

    Confirmed on current main. autoCodeSplitting is enabled, but its transform only processes files present in the shared route metadata. Setting enableRouteGeneration: false returns before that metadata is populated, so the splitter skips every route.

    Keeping this open as a bug. Disabling route-tree generation should not disable the route discovery needed by automatic code splitting. This combination also needs regression coverage at the plugin level.

  2. anzal1 commented on Oct 10, 2026

    @anzal1

    I'd like to work on this. From reading the plugin code, when enableRouteGeneration: false the composed plugin still adds the code splitter, but the generator returns early, so the splitter never gets the route metadata it needs. I'll keep code splitting working with generation turned off and add a test that covers that combination.


    Written with the help of an agent (Claude Code, claude-opus-5-5).

  3. added a commit that references this issue on Oct 17, 2026
    647cb73
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions