File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
packages/plugin-react-swc Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
+ ### Skip HMR preamble in Vitest browser mode
6
+
7
+ This was causing annoying ` Sourcemap for "/@react-refresh" points to missing source files ` and is unnecessary in test mode.
8
+
5
9
## 3.9.0 (2025-04-15)
6
10
7
11
### Make compatible with rolldown-vite
Original file line number Diff line number Diff line change @@ -132,13 +132,17 @@ const react = (_options?: Options): PluginOption[] => {
132
132
)
133
133
}
134
134
} ,
135
- transformIndexHtml : ( _ , config ) => [
136
- {
137
- tag : 'script' ,
138
- attrs : { type : 'module' } ,
139
- children : getPreambleCode ( config . server ! . config . base ) ,
140
- } ,
141
- ] ,
135
+ transformIndexHtml : ( _ , config ) => {
136
+ if ( ! hmrDisabled ) {
137
+ return [
138
+ {
139
+ tag : 'script' ,
140
+ attrs : { type : 'module' } ,
141
+ children : getPreambleCode ( config . server ! . config . base ) ,
142
+ } ,
143
+ ]
144
+ }
145
+ } ,
142
146
async transform ( code , _id , transformOptions ) {
143
147
const id = _id . split ( '?' ) [ 0 ]
144
148
const refresh = ! transformOptions ?. ssr && ! hmrDisabled
You can’t perform that action at this time.
0 commit comments