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 22
33## Unreleased
44
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+
59## 3.9.0 (2025-04-15)
610
711### Make compatible with rolldown-vite
Original file line number Diff line number Diff line change @@ -132,13 +132,17 @@ const react = (_options?: Options): PluginOption[] => {
132132 )
133133 }
134134 } ,
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+ } ,
142146 async transform ( code , _id , transformOptions ) {
143147 const id = _id . split ( '?' ) [ 0 ]
144148 const refresh = ! transformOptions ?. ssr && ! hmrDisabled
You can’t perform that action at this time.
0 commit comments