Skip to content

Conversation

sapphi-red
Copy link
Member

Description

By changing $RefreshReg$ / $RefreshSig$ to a local variable and leveraging the function hoisting, we can avoid the sourcemap generation for the refresh wrapper completely. Also this would reduce the code size, which would also improve the perf a bit.

@sapphi-red sapphi-red marked this pull request as ready for review September 11, 2025 09:07
Copy link
Member

@ArnaudBarre ArnaudBarre left a comment

Choose a reason for hiding this comment

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

Nice

@sapphi-red sapphi-red merged commit 3a8b4a9 into main Sep 11, 2025
11 checks passed
@sapphi-red sapphi-red deleted the perf/avoid-sourcemap-for-refresh-wrapper-injection branch September 11, 2025 12:15
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Sep 17, 2025
| datasource | package              | from  | to    |
| ---------- | -------------------- | ----- | ----- |
| npm        | @vitejs/plugin-react | 5.0.2 | 5.0.3 |


## [v5.0.3](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#503-2025-09-17)

##### HMR did not work for components imported with queries with rolldown-vite ([#872](vitejs/vite-plugin-react#872))

##### Perf: simplify refresh wrapper generation ([#835](vitejs/vite-plugin-react#835))
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Sep 18, 2025
| datasource | package              | from  | to    |
| ---------- | -------------------- | ----- | ----- |
| npm        | @vitejs/plugin-react | 5.0.2 | 5.0.3 |


## [v5.0.3](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#503-2025-09-17)

##### HMR did not work for components imported with queries with rolldown-vite ([#872](vitejs/vite-plugin-react#872))

##### Perf: simplify refresh wrapper generation ([#835](vitejs/vite-plugin-react#835))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants