Skip to content

TanStack Router HMR issues with Rolldown-Vite #871

@TheAlexLichter

Description

@TheAlexLichter

Describe the regression

Hot Module Replacement (HMR) is not functioning correctly when using Vite with Rolldown and TanStack router. The issue specifically affects pages in the "routes" folder, while components outside of route files work but experience slow HMR performance.

Copied from TanStack/router#5100

Reproduction

https://github.com/Hardel-DW/tanstack-bug-hmr

Expected Behavior

HMR should work normally for all files including those in the routes folder HMR should have fast refresh times similar to standard Vite

Actual Behavior

HMR is very slow.

Steps to Reproduce

  1. Set up a project with Vite + Rolldown "vite": "npm:rolldown-vite@latest"

  2. Create routes in the routes folder

import { createFileRoute } from "@tanstack/react-router";

export const Route = createFileRoute("/$lang/hello")({
    component: Page,
});

function Page() {
    return (
        <div>
            Hello world
        </div>
    );
}
  1. Make changes to route components. E.g change "Hello world" -"Hello Bug"

  2. Observe that HMR does not trigger. (But the console detect HMR)

  3. Make changes to components outside routes folder

  4. Observe slow HMR performance

System Info

  • Router: @tanstack/react-router": "^1.131.31

  • OS: Windows

  • Browser: Chrome, Firefox and Zen

  • Browser Version: 139 For Chrome

  • Bundler: Vite Rolldown

  • Bundler Version: "vite": "npm:rolldown-vite@latest"

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions