Skip to content

Latest Vite version HMR does not work with router #532

@maxwellwalin

Description

@maxwellwalin

Describe the bug

When using the latest version of Vite (npm create vite@latest --template react-ts), router throws reference error as if there was circular dependency or something similar.

If I downgrade the Vite version / vite react plugin version to the version given in the stackblitz template (2.X, 1.X, respectively), it all works fine.

[ReferenceError: Cannot access](client.ts:113 ReferenceError: Cannot access 'homeLayout' before initialization)

Your Example Website or App

https://stackblitz.com/edit/github-4pq3ja?file=package.json

Steps to Reproduce the Bug or Issue

  1. Go to 'src/pages/home/Dashboard'.
  2. After forking, try to change the content on the page.
  3. You will see HMR error in the console.

Expected behavior

No error occurs.

Screenshots or Videos

No response

Platform

  • OS: Windows 10
  • Browser: Chrome

Additional context

No response

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