Conversation
| : undefined, | ||
| resolveId: { | ||
| filter: { id: exactRegex(runtimePublicPath) }, | ||
| handler: (id) => (id === runtimePublicPath ? id : undefined), |
There was a problem hiding this comment.
We still need to keep the if statements to keep the compat for Vite older than v6.3.
| id: { | ||
| include: ensureArray(include).map(matchWithQuery), | ||
| exclude: [ | ||
| ...(exclude ? ensureArray(exclude).map(matchWithQuery) : []), | ||
| /\/node_modules\//, | ||
| ], |
There was a problem hiding this comment.
This filter conversion and the two utils feels a bit tricky IMO.
Could this be upstream into the Vite createFilter function so that it can be reused by other plugins?
There was a problem hiding this comment.
If we add a util function to Vite, we need to bump the required peer dep in this plugin (and the other plugins that wants to use that) which is a breaking change. I think if we do that we probably should add it to a separate package.
I'll consider if we can have @rolldown/pluginutils (since I sent a PR to @rollup/pluginutils that adds some utils functions and it's taking some time to be merged).
There was a problem hiding this comment.
This could be added and then we could do import * as Vite from 'vite' and check for the export name existence so that people using the latest version have the speedup (which is expecting for people running rolldown vite)
There was a problem hiding this comment.
I've updated the code to use @rolldown/pluginutils. ensureArray is still there because we need to combine with /\/node_modules\//, but I think it is now simple enough.
packages/plugin-react/src/index.ts
Outdated
| skipFastRefresh && | ||
| isProduction |
There was a problem hiding this comment.
isProduction implies skipFastRefresh for now so we can skip the second check but it doesn't hurt so up to you
There was a problem hiding this comment.
Actually, I think this is needed. For example, when config.command === 'build' && !isProduction is true (NODE_ENV=development vite build), this if block should not be executed. Otherwise @babel/plugin-transform-react-jsx-self / @babel/plugin-transform-react-jsx-source won't run.
|
Just noticed that I forgot to add the changelog. Added 👍 |
| datasource | package | from | to | | ---------- | -------------------- | ----- | ----- | | npm | @vitejs/plugin-react | 4.4.1 | 4.5.0 | ## [v4.5.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#450-2025-05-23) ##### Add `filter` for rolldown-vite [#470](vitejs/vite-plugin-react#470) Added `filter` so that it is more performant when running this plugin with rolldown-powered version of Vite. ##### Skip HMR for JSX files with hooks [#480](vitejs/vite-plugin-react#480) This removes the HMR warning for hooks with JSX.
| datasource | package | from | to | | ---------- | -------------------- | ----- | ----- | | npm | @vitejs/plugin-react | 4.4.1 | 4.5.0 | ## [v4.5.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#450-2025-05-23) ##### Add `filter` for rolldown-vite [#470](vitejs/vite-plugin-react#470) Added `filter` so that it is more performant when running this plugin with rolldown-powered version of Vite. ##### Skip HMR for JSX files with hooks [#480](vitejs/vite-plugin-react#480) This removes the HMR warning for hooks with JSX.
| datasource | package | from | to | | ---------- | -------------------- | ----- | ----- | | npm | @vitejs/plugin-react | 4.4.1 | 4.5.0 | ## [v4.5.0](https://github.com/vitejs/vite-plugin-react/blob/HEAD/packages/plugin-react/CHANGELOG.md#450-2025-05-23) ##### Add `filter` for rolldown-vite [#470](vitejs/vite-plugin-react#470) Added `filter` so that it is more performant when running this plugin with rolldown-powered version of Vite. ##### Skip HMR for JSX files with hooks [#480](vitejs/vite-plugin-react#480) This removes the HMR warning for hooks with JSX.
 <h3>Snyk has created this PR to upgrade @vitejs/plugin-react from 4.4.1 to 4.5.0.</h3> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. <hr/> - The recommended version is **1 version** ahead of your current version. - The recommended version was released **a month ago**. <details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>@vitejs/plugin-react</b></summary> <ul> <li> <b>4.5.0</b> - <a href="https://redirect.github.com/vitejs/vite-plugin-react/releases/tag/plugin-react%404.5.0">2025-05-23</a></br><h3>Add <code>filter</code> for rolldown-vite <a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/470" data-hovercard-type="pull_request" data-hovercard-url="/vitejs/vite-plugin-react/pull/470/hovercard">#470</a></h3> <p>Added <code>filter</code> so that it is more performant when running this plugin with rolldown-powered version of Vite.</p> <h3>Skip HMR for JSX files with hooks <a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/480" data-hovercard-type="pull_request" data-hovercard-url="/vitejs/vite-plugin-react/pull/480/hovercard">#480</a></h3> <p>This removes the HMR warning for hooks with JSX.</p> </li> <li> <b>4.4.1</b> - 2025-04-19 </li> </ul> from <a href="https://redirect.github.com/vitejs/vite-plugin-react/releases">@vitejs/plugin-react GitHub release notes</a> </details> </details> --- > [!IMPORTANT] > > - Check the changes in this PR to ensure they won't cause issues with your project. > - This PR was automatically created by Snyk using the credentials of a real user. --- **Note:** _You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs._ **For more information:** <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiIyNGI4NzZkMy05NDE3LTRjODktOThlNS0wZDEyMjhjMjRhMjIiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjI0Yjg3NmQzLTk0MTctNGM4OS05OGU1LTBkMTIyOGMyNGEyMiJ9fQ==" width="0" height="0"/> > - 🧐 [View latest project report](https://app.snyk.io/org/spine-semantic-infrastructure/project/b121e0a0-7979-4b24-be4d-3b874e16b0c8?utm_source=github&utm_medium=referral&page=upgrade-pr) > - 📜 [Customise PR templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template) > - 🛠 [Adjust upgrade PR settings](https://app.snyk.io/org/spine-semantic-infrastructure/project/b121e0a0-7979-4b24-be4d-3b874e16b0c8/settings/integration?utm_source=github&utm_medium=referral&page=upgrade-pr) > - 🔕 [Ignore this dependency or unsubscribe from future upgrade PRs](https://app.snyk.io/org/spine-semantic-infrastructure/project/b121e0a0-7979-4b24-be4d-3b874e16b0c8/settings/integration?pkg=@vitejs/plugin-react&utm_source=github&utm_medium=referral&page=upgrade-pr#auto-dep-upgrades) [//]: # 'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"@vitejs/plugin-react","from":"4.4.1","to":"4.5.0"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"24b876d3-9417-4c89-98e5-0d1228c24a22","prPublicId":"24b876d3-9417-4c89-98e5-0d1228c24a22","packageManager":"npm","priorityScoreList":[],"projectPublicId":"b121e0a0-7979-4b24-be4d-3b874e16b0c8","projectUrl":"https://app.snyk.io/org/spine-semantic-infrastructure/project/b121e0a0-7979-4b24-be4d-3b874e16b0c8?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2025-05-23T00:34:35.256Z"},"vulns":[]}' Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Description
Adds
filterso that it makes these plugin performant when used in rolldown-vite.