Skip to content

Commit f579b37

Browse files
committed
chore: ensure once
1 parent a6edb50 commit f579b37

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/common/refresh-utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ const refreshContentRE = /\$RefreshReg\$\(/
1010
export const preambleCode = `import { injectIntoGlobalHook } from "__BASE__${runtimePublicPath.slice(
1111
1,
1212
)}";
13+
if (!window.__vite_plugin_react_preamble_installed__) {
1314
injectIntoGlobalHook(window);
1415
window.$RefreshReg$ = () => {};
1516
window.$RefreshSig$ = () => (type) => type;
17+
}
18+
window.__vite_plugin_react_preamble_installed__ = true;
1619
`
1720

1821
export const getPreambleCode = (base: string): string =>

0 commit comments

Comments
 (0)