Skip to content

Window is not defined error when upgrading @vitejs/plugin-react to 5.0.3 or later #1045

@mtmacdonald

Description

@mtmacdonald

Related plugins

Describe the bug

When upgrading from @vitejs/plugin-react version 5.0.2 to 5.0.3, I started getting an error in my build:

ReferenceError: window is not defined @react-refresh:599:1
@react-refresh:599

Image

I'm stuck on the old version for now. Is it possible to please check if this is a regression bug, or something I need to fix/workaround in my project, and if so, any tips?

Thank you!

Reproduction

https://github.com/mtmacdonald/docgen

Steps to reproduce

To reproduce

System Info

System:
    OS: macOS 26.2
    CPU: (12) arm64 Apple M2 Pro
    Memory: 152.05 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.19.0 - /Users/mark/.nvm/versions/node/v22.19.0/bin/node
    Yarn: 1.22.22 - /Users/mark/.nvm/versions/node/v22.19.0/bin/yarn
    npm: 10.9.3 - /Users/mark/.nvm/versions/node/v22.19.0/bin/npm
  Browsers:
    Chrome: 143.0.7499.193
    Firefox: 136.0.4
    Firefox Developer Edition: 147.0
    Safari: 26.2
  npmPackages:
    @vitejs/plugin-react: 5.0.3 => 5.0.3
    rolldown-vite: ^7.3.1 => 7.1.0

Used Package Manager

yarn

Logs

ReferenceError: window is not defined @react-refresh:599:1
@react-refresh:599

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions