Skip to content

Rolldown Vite issue with HMRΒ #5100

@Hardel-DW

Description

@Hardel-DW

Which project does this relate to?

Router

Describe the bug

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

Your Example Website or App

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

Steps to Reproduce the Bug or Issue

  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

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

Screenshots or Videos

2025-09-02_13-22-57.mp4

Platform

  • 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"

Additional context

It's annoying because we don't know where it comes from when it appears.
In my case, I migrated from NextJS to TanStack Router, and I was using vite rolldown, which worked with NextJS. But that caused me problems here but it took me a long time to understand that it was the roll down that was the problem..

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