Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🔧 chore: gate react-scan behind REACT_SCAN env flag (#16847)

Innei40db39ac95ce
diff --git a/plugins/vite/sharedRendererConfig.ts b/plugins/vite/sharedRendererConfig.ts
index 6dd6dc1fb74..a60c669ced9 100644
--- a/plugins/vite/sharedRendererConfig.ts
+++ b/plugins/vite/sharedRendererConfig.ts
@@ -242,6 +242,7 @@ export function sharedRendererDefine(options: { isElectron: boolean; isMobile: b
'__DEV__': process.env.NODE_ENV !== 'production' ? 'true' : 'false',
'__ELECTRON__': JSON.stringify(options.isElectron),
'__MOBILE__': JSON.stringify(options.isMobile),
+ '__REACT_SCAN__': process.env.REACT_SCAN === 'true' ? 'true' : 'false',
'__TEST__': 'false',
...nextPublicDefine,
// Keep a safe fallback so generic `process.env` access won't crash in browser runtime.
diff --git a/src/initialize.ts b/src/initialize.ts
index 422216bb64e..482937cf363 100644
--- a/src/initialize.ts
+++ b/src/initialize.ts
@@ -33,8 +33,8 @@ if (typeof window !== 'undefined') {
});
}
-if (__DEV__) {
+if (__DEV__ && __REACT_SCAN__) {
void import('react-scan').then(({ scan }) => {
- scan({ enabled: false, showToolbar: true });
+ scan({ enabled: true, showToolbar: true });
});
}