feat(profiling): add react-scan via direct import for dev-only profiling

This commit is contained in:
plebeius
2026-02-26 16:02:19 +08:00
parent 00a1164adf
commit cd71602730
3 changed files with 11 additions and 10 deletions
+1
View File
@@ -1,4 +1,5 @@
import './polyfills.js';
import './lib/react-scan';
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './app';
+10
View File
@@ -0,0 +1,10 @@
if (import.meta.env.DEV) {
const { scan, getReport } = await import('react-scan');
scan({
enabled: true,
showToolbar: !(window as any).__PROFILING__,
playSound: !(window as any).__PROFILING__,
report: true,
});
(window as any).__getReactScanReport = getReport;
}