Fix black screen: wait for Vite before Electron, retry loadURL, show boot fallback.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+18
-1
@@ -2,4 +2,21 @@ import { createRoot } from 'react-dom/client';
|
||||
import { App } from './App.tsx';
|
||||
import './styles.css';
|
||||
|
||||
createRoot(document.getElementById('root')!).render(<App />);
|
||||
const rootEl = document.getElementById('root');
|
||||
if (!rootEl) {
|
||||
document.body.innerHTML = '<pre style="color:#f66;padding:24px">#root missing</pre>';
|
||||
} else {
|
||||
try {
|
||||
createRoot(rootEl).render(<App />);
|
||||
} catch (err) {
|
||||
rootEl.innerHTML = `<pre style="color:#f66;padding:24px;white-space:pre-wrap">${String(err)}</pre>`;
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('error', (e) => {
|
||||
console.error('window.error', e.error || e.message);
|
||||
});
|
||||
window.addEventListener('unhandledrejection', (e) => {
|
||||
console.error('unhandledrejection', e.reason);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user