File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ export const preambleCode = `import { injectIntoGlobalHook } from "__BASE__${run
12
12
) } ";
13
13
injectIntoGlobalHook(window);
14
14
window.$RefreshReg$ = () => {};
15
- window.$RefreshSig$ = () => (type) => type;`
15
+ window.$RefreshSig$ = () => (type) => type;
16
+ `
16
17
17
18
export const getPreambleCode = ( base : string ) : string =>
18
19
preambleCode . replace ( '__BASE__' , base )
@@ -94,5 +95,13 @@ export function virtualPreamblePlugin({
94
95
}
95
96
} ,
96
97
} ,
98
+ transform : {
99
+ filter : { code : / _ _ R E A C T _ D E V T O O L S _ G L O B A L _ H O O K _ _ / } ,
100
+ handler ( code ) {
101
+ if ( isEnabled ( ) && code . includes ( '__REACT_DEVTOOLS_GLOBAL_HOOK__' ) ) {
102
+ return `import ${ JSON . stringify ( name ) } ;` + code
103
+ }
104
+ } ,
105
+ } ,
97
106
}
98
107
}
Original file line number Diff line number Diff line change @@ -510,11 +510,11 @@ export default function viteReact(opts: Options = {}): Plugin[] {
510
510
transformIndexHtml ( ) {
511
511
if ( ! skipFastRefresh && ! isFullBundle )
512
512
return [
513
- {
514
- tag : 'script' ,
515
- attrs : { type : 'module' } ,
516
- children : getPreambleCode ( base ) ,
517
- } ,
513
+ // {
514
+ // tag: 'script',
515
+ // attrs: { type: 'module' },
516
+ // children: getPreambleCode(base),
517
+ // },
518
518
]
519
519
} ,
520
520
}
Original file line number Diff line number Diff line change 1
- import '@vitejs/plugin-react/preamble'
2
1
import ReactDOM from 'react-dom/client'
3
2
import { App } from './App'
4
3
You can’t perform that action at this time.
0 commit comments