Skip to content

RefreshRuntime is not added when primitive return type #414

@nojaf

Description

@nojaf

Describe the bug

When returning a plain string from a function component, the fast refresh is not added.
While I believe React does consider this as a valid component.

function Foo(props) {
  return 'meh2';
}

let make = Foo;

export { make };

Reproduction

https://stackblitz.com/edit/vitejs-vite-wzbtgaex?file=src%2FFoo.js

Steps to reproduce

  • npm i
  • npm run dev
  • Edit Foo.js (page reload)
  • Edit Bar.js (hmr reload)

System Info

System:
    OS: macOS 15.3
    CPU: (16) arm64 Apple M4 Max
    Memory: 698.27 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.13.1 - ~/.nvm/versions/node/v22.13.1/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.13.1/bin/npm
    pnpm: 9.15.5 - ~/.nvm/versions/node/v22.13.1/bin/pnpm
    bun: 1.2.2 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 133.1.75.178
    Chrome: 133.0.6943.99
    Safari: 18.3
  npmPackages:
    @vitejs/plugin-react: ^4.3.4 => 4.3.4 
    vite: ^6.1.0 => 6.1.0

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions