Skip to content

plugin-vue injects React Fast Refresh runtime ($RefreshSig$) into Vue SFCs when @vitejs/plugin-react is present #798

Description

@KoukiOhno

Related plugins

Describe the bug

If @vitejs/plugin-vue and @vitejs/plugin-react live in the same Vite config,
some of my <script setup lang="ts"> Vue components started getting React Fast
Refresh code ($RefreshSig$ / $RefreshReg$) injected into them.

That's harmless on pages that also load React, but our app has Vue-only pages
(server-rendered, no @viteReactRefresh runtime). On those, dev blows up with:

Uncaught ReferenceError: $RefreshSig$ is not defined

It's dev-only — production builds are fine.

Reproduction

https://github.com/KoukiOhno/plugin-vue-react-refresh-repro

Steps to reproduce

It doesn't happen on every SFC, which is why it was tricky to pin down. It needs
all three of these at once:

  1. plugin-react is present (it sets jsx.refresh: true on the global config.oxc)
  2. the SFC uses <script setup lang="ts"> (this is what sends it down the
    transformWithOxc path)
  3. the script has something oxc's refresh pass thinks is a hook/component

In practice (3) just means a use* call. Vue composables like useSlots(),
useRoute(), useStore() all trigger it, since oxc keys off the use prefix.
A bare SFC with no such call slips through untouched — that's why the repro
deliberately calls useSlots().

System Info

System:
  OS: Linux 6.18 Ubuntu 24.04.2 LTS
  CPU: (12) x64 Intel(R) Core(TM) i7-14700K
  Shell: /bin/bash
Binaries:
  Node: 24.14.1
  npm: 11.11.0
  pnpm: 10.29.3
Browsers:
  Chrome: 149.0.7827.155
npmPackages:
  @vitejs/plugin-react: 6.0.2 => 6.0.2
  @vitejs/plugin-vue: 6.0.6 => 6.0.6   (also repros on 6.0.7)
  vite: 8.0.16 => 8.0.16
  vue: 3.5.35

Used Package Manager

pnpm

Logs

No response

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