Skip to content

Conversation

sapphi-red
Copy link
Member

Description

fixes vitejs/rolldown-vite#368

@sapphi-red sapphi-red added p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) plugin: react labels Aug 12, 2025
Copy link
Contributor

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this happen only on class component?

@ArnaudBarre
Copy link
Member

I need to look at it in details, because it means the host option is not respected then.
What was the initial reason for rolldown-vite to include framework specific hmr?

Copy link
Contributor

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this happen only on class component?

This condition reactCompRE was causing the first addRefreshWrapper during vite:react-babel to inject wrapper.

if (!hasRefresh && !onlyReactComp) return { code, map: normalizedMap }

@hi-ogawa
Copy link
Contributor

I need to look at it in details, because it means the host option is not respected then. What was the initial reason for rolldown-vite to include framework specific hmr?

Rolldown-vite doesn't inject refresh "wrapper", but it only takes care of refresh "transform". Rolldown-vite still uses vite:react:refresh-wrapper plugin below and addRefreshWrapper during vite:react-babel was meant to be skipped (but it wasn't, thus bug).

Indeed, reactRefreshHost isn't passed to vite:react:refresh-wrapper, so that's also a separate bug.

@hi-ogawa hi-ogawa merged commit a22f29b into main Aug 14, 2025
11 checks passed
@hi-ogawa hi-ogawa deleted the fix/react-refresh-wrapper-was-injected-twice-for-class-components-when-using-babel-plugins-and-rolldown-vite branch August 14, 2025 01:07
@ArnaudBarre
Copy link
Member

Thanks the condition after the update seems better for me!

renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Aug 23, 2025
| datasource | package              | from  | to    |
| ---------- | -------------------- | ----- | ----- |
| npm        | @vitejs/plugin-react | 4.7.0 | 5.0.1 |


## [v5.0.1](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#501-2025-08-19)

##### Set `optimizeDeps.rollupOptions.transform.jsx` instead of `optimizeDeps.rollupOptions.jsx` for rolldown-vite ([#735](vitejs/vite-plugin-react#735))

`optimizeDeps.rollupOptions.jsx` is going to be deprecated in favor of `optimizeDeps.rollupOptions.transform.jsx`.

##### Perf: skip `babel-plugin-react-compiler` if code has no `"use memo"` when `{ compilationMode: "annotation" }` ([#734](vitejs/vite-plugin-react#734))

##### Respect tsconfig `jsxImportSource` ([#726](vitejs/vite-plugin-react#726))

##### Fix `reactRefreshHost` option on rolldown-vite ([#716](vitejs/vite-plugin-react#716))

##### Fix `RefreshRuntime` being injected twice for class components on rolldown-vite ([#708](vitejs/vite-plugin-react#708))

##### Skip `babel-plugin-react-compiler` on non client environment ([689](vitejs/vite-plugin-react#689))


## [v5.0.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#500-2025-08-07)
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Aug 23, 2025
| datasource | package              | from  | to    |
| ---------- | -------------------- | ----- | ----- |
| npm        | @vitejs/plugin-react | 4.7.0 | 5.0.1 |


## [v5.0.1](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#501-2025-08-19)

##### Set `optimizeDeps.rollupOptions.transform.jsx` instead of `optimizeDeps.rollupOptions.jsx` for rolldown-vite ([#735](vitejs/vite-plugin-react#735))

`optimizeDeps.rollupOptions.jsx` is going to be deprecated in favor of `optimizeDeps.rollupOptions.transform.jsx`.

##### Perf: skip `babel-plugin-react-compiler` if code has no `"use memo"` when `{ compilationMode: "annotation" }` ([#734](vitejs/vite-plugin-react#734))

##### Respect tsconfig `jsxImportSource` ([#726](vitejs/vite-plugin-react#726))

##### Fix `reactRefreshHost` option on rolldown-vite ([#716](vitejs/vite-plugin-react#716))

##### Fix `RefreshRuntime` being injected twice for class components on rolldown-vite ([#708](vitejs/vite-plugin-react#708))

##### Skip `babel-plugin-react-compiler` on non client environment ([689](vitejs/vite-plugin-react#689))


## [v5.0.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#500-2025-08-07)
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Aug 24, 2025
| datasource | package              | from  | to    |
| ---------- | -------------------- | ----- | ----- |
| npm        | @vitejs/plugin-react | 4.7.0 | 5.0.1 |


## [v5.0.1](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#501-2025-08-19)

##### Set `optimizeDeps.rollupOptions.transform.jsx` instead of `optimizeDeps.rollupOptions.jsx` for rolldown-vite ([#735](vitejs/vite-plugin-react#735))

`optimizeDeps.rollupOptions.jsx` is going to be deprecated in favor of `optimizeDeps.rollupOptions.transform.jsx`.

##### Perf: skip `babel-plugin-react-compiler` if code has no `"use memo"` when `{ compilationMode: "annotation" }` ([#734](vitejs/vite-plugin-react#734))

##### Respect tsconfig `jsxImportSource` ([#726](vitejs/vite-plugin-react#726))

##### Fix `reactRefreshHost` option on rolldown-vite ([#716](vitejs/vite-plugin-react#716))

##### Fix `RefreshRuntime` being injected twice for class components on rolldown-vite ([#708](vitejs/vite-plugin-react#708))

##### Skip `babel-plugin-react-compiler` on non client environment ([689](vitejs/vite-plugin-react#689))


## [v5.0.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#500-2025-08-07)
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Sep 1, 2025
| datasource | package              | from  | to    |
| ---------- | -------------------- | ----- | ----- |
| npm        | @vitejs/plugin-react | 4.7.0 | 5.0.2 |


## [v5.0.2](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#502-2025-08-28)

##### Skip transform hook completely in rolldown-vite in dev if possible ([#783](vitejs/vite-plugin-react#783))


## [v5.0.1](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#501-2025-08-19)

##### Set `optimizeDeps.rollupOptions.transform.jsx` instead of `optimizeDeps.rollupOptions.jsx` for rolldown-vite ([#735](vitejs/vite-plugin-react#735))

`optimizeDeps.rollupOptions.jsx` is going to be deprecated in favor of `optimizeDeps.rollupOptions.transform.jsx`.

##### Perf: skip `babel-plugin-react-compiler` if code has no `"use memo"` when `{ compilationMode: "annotation" }` ([#734](vitejs/vite-plugin-react#734))

##### Respect tsconfig `jsxImportSource` ([#726](vitejs/vite-plugin-react#726))

##### Fix `reactRefreshHost` option on rolldown-vite ([#716](vitejs/vite-plugin-react#716))

##### Fix `RefreshRuntime` being injected twice for class components on rolldown-vite ([#708](vitejs/vite-plugin-react#708))

##### Skip `babel-plugin-react-compiler` on non client environment ([689](vitejs/vite-plugin-react#689))


## [v5.0.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#500-2025-08-07)
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Sep 1, 2025
| datasource | package              | from  | to    |
| ---------- | -------------------- | ----- | ----- |
| npm        | @vitejs/plugin-react | 4.7.0 | 5.0.2 |


## [v5.0.2](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#502-2025-08-28)

##### Skip transform hook completely in rolldown-vite in dev if possible ([#783](vitejs/vite-plugin-react#783))


## [v5.0.1](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#501-2025-08-19)

##### Set `optimizeDeps.rollupOptions.transform.jsx` instead of `optimizeDeps.rollupOptions.jsx` for rolldown-vite ([#735](vitejs/vite-plugin-react#735))

`optimizeDeps.rollupOptions.jsx` is going to be deprecated in favor of `optimizeDeps.rollupOptions.transform.jsx`.

##### Perf: skip `babel-plugin-react-compiler` if code has no `"use memo"` when `{ compilationMode: "annotation" }` ([#734](vitejs/vite-plugin-react#734))

##### Respect tsconfig `jsxImportSource` ([#726](vitejs/vite-plugin-react#726))

##### Fix `reactRefreshHost` option on rolldown-vite ([#716](vitejs/vite-plugin-react#716))

##### Fix `RefreshRuntime` being injected twice for class components on rolldown-vite ([#708](vitejs/vite-plugin-react#708))

##### Skip `babel-plugin-react-compiler` on non client environment ([689](vitejs/vite-plugin-react#689))


## [v5.0.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#500-2025-08-07)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) plugin: react

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rolldown-vite 7.1.0 and plugin-react 5.0.0 error with Class components when using react-compiler

4 participants