File tree 10 files changed +206
-126
lines changed
10 files changed +206
-126
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
+ ### Add ` filter ` for rolldown-vite
6
+
7
+ Added ` filter ` so that it is more performant when running this plugin with rolldown-powered version of Vite.
8
+
5
9
## 0.1.1 (2025-04-10)
6
10
7
11
## 0.1.0 (2025-04-09)
Original file line number Diff line number Diff line change 46
46
"@vitejs/react-common" : " workspace:*" ,
47
47
"unbuild" : " ^3.5.0" ,
48
48
"vite" : " catalog:rolldown-vite"
49
+ },
50
+ "dependencies" : {
51
+ "@rolldown/pluginutils" : " 1.0.0-beta.9"
49
52
}
50
53
}
Original file line number Diff line number Diff line change 9
9
runtimePublicPath ,
10
10
silenceUseClientWarning ,
11
11
} from '@vitejs/react-common'
12
+ import { exactRegex } from '@rolldown/pluginutils'
12
13
13
14
const _dirname = dirname ( fileURLToPath ( import . meta. url ) )
14
15
@@ -149,12 +150,3 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
149
150
150
151
return [ viteConfig , viteRefreshRuntime , viteRefreshWrapper ]
151
152
}
152
-
153
- function exactRegex ( input : string ) : RegExp {
154
- return new RegExp ( `^${ escapeRegex ( input ) } $` )
155
- }
156
-
157
- const escapeRegexRE = / [ - / \\ ^ $ * + ? . ( ) | [ \] { } ] / g
158
- function escapeRegex ( str : string ) : string {
159
- return str . replace ( escapeRegexRE , '\\$&' )
160
- }
Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
+ ### Add ` filter ` for rolldown-vite
6
+
7
+ Added ` filter ` so that it is more performant when running this plugin with rolldown-powered version of Vite.
8
+
5
9
### Skip HMR preamble in Vitest browser mode
6
10
7
11
This was causing annoying ` Sourcemap for "/@react-refresh" points to missing source files ` and is unnecessary in test mode.
Original file line number Diff line number Diff line change 29
29
},
30
30
"homepage" : " https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc#readme" ,
31
31
"dependencies" : {
32
+ "@rolldown/pluginutils" : " 1.0.0-beta.9" ,
32
33
"@swc/core" : " ^1.11.22"
33
34
},
34
35
"peerDependencies" : {
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
18
18
runtimePublicPath ,
19
19
silenceUseClientWarning ,
20
20
} from '@vitejs/react-common'
21
+ import { exactRegex } from '@rolldown/pluginutils'
21
22
22
23
/* eslint-disable no-restricted-globals */
23
24
const _dirname =
@@ -96,14 +97,23 @@ const react = (_options?: Options): PluginOption[] => {
96
97
name : 'vite:react-swc:resolve-runtime' ,
97
98
apply : 'serve' ,
98
99
enforce : 'pre' , // Run before Vite default resolve to avoid syscalls
99
- resolveId : ( id ) => ( id === runtimePublicPath ? id : undefined ) ,
100
- load : ( id ) =>
101
- id === runtimePublicPath
102
- ? readFileSync ( join ( _dirname , 'refresh-runtime.js' ) , 'utf-8' ) . replace (
103
- / _ _ R E A D M E _ U R L _ _ / g,
104
- 'https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc' ,
105
- )
106
- : undefined ,
100
+ resolveId : {
101
+ filter : { id : exactRegex ( runtimePublicPath ) } ,
102
+ handler : ( id ) => ( id === runtimePublicPath ? id : undefined ) ,
103
+ } ,
104
+ load : {
105
+ filter : { id : exactRegex ( runtimePublicPath ) } ,
106
+ handler : ( id ) =>
107
+ id === runtimePublicPath
108
+ ? readFileSync (
109
+ join ( _dirname , 'refresh-runtime.js' ) ,
110
+ 'utf-8' ,
111
+ ) . replace (
112
+ / _ _ R E A D M E _ U R L _ _ / g,
113
+ 'https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc' ,
114
+ )
115
+ : undefined ,
116
+ } ,
107
117
} ,
108
118
{
109
119
name : 'vite:react-swc' ,
Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
+ ### Add ` filter ` for rolldown-vite
6
+
7
+ Added ` filter ` so that it is more performant when running this plugin with rolldown-powered version of Vite.
8
+
5
9
## 4.4.1 (2025-04-19)
6
10
7
11
Fix type issue when using ` moduleResolution: "node" ` in tsconfig [ #462 ] ( https://github.com/vitejs/vite-plugin-react/pull/462 )
Original file line number Diff line number Diff line change 51
51
"@babel/core" : " ^7.26.10" ,
52
52
"@babel/plugin-transform-react-jsx-self" : " ^7.25.9" ,
53
53
"@babel/plugin-transform-react-jsx-source" : " ^7.25.9" ,
54
+ "@rolldown/pluginutils" : " 1.0.0-beta.9" ,
54
55
"@types/babel__core" : " ^7.20.5" ,
55
56
"react-refresh" : " ^0.17.0"
56
57
},
You can’t perform that action at this time.
0 commit comments