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
1212) } ";
1313injectIntoGlobalHook(window);
1414window.$RefreshReg$ = () => {};
15- window.$RefreshSig$ = () => (type) => type;`
15+ window.$RefreshSig$ = () => (type) => type;
16+ `
1617
1718export const getPreambleCode = ( base : string ) : string =>
1819 preambleCode . replace ( '__BASE__' , base )
@@ -94,5 +95,13 @@ export function virtualPreamblePlugin({
9495 }
9596 } ,
9697 } ,
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+ } ,
97106 }
98107}
Original file line number Diff line number Diff line change @@ -510,11 +510,11 @@ export default function viteReact(opts: Options = {}): Plugin[] {
510510 transformIndexHtml ( ) {
511511 if ( ! skipFastRefresh && ! isFullBundle )
512512 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+ // },
518518 ]
519519 } ,
520520 }
Original file line number Diff line number Diff line change 1- import '@vitejs/plugin-react/preamble'
21import ReactDOM from 'react-dom/client'
32import { App } from './App'
43
You can’t perform that action at this time.
0 commit comments