import { createRoot } from "react-dom/client";
import App from "./App";
import "./index.css";
// Type declaration for global callback
declare global {
interface Window {
appLoaded?: () => void;
}
}
console.log('🎬 main.tsx starting...');
// Force immediate execution - no waiting for DOM
document.addEventListener('DOMContentLoaded', function() {
console.log('📄 DOM Content Loaded');
});
// Disable Service Worker for now - can cause caching issues
// if ('serviceWorker' in navigator) {
// window.addEventListener('load', () => {
// navigator.serviceWorker.register('/sw.js')
// .then((registration) => {
// console.log('SW registered: ', registration);
// })
// .catch((registrationError) => {
// console.log('SW registration failed: ', registrationError);
// });
// });
// }
// Force immediate execution function
function initApp() {
try {
const rootElement = document.getElementById("root");
console.log('🎯 Root element found:', rootElement);
if (!rootElement) {
throw new Error('Root element not found');
}
console.log('🚀 Creating React root...');
const root = createRoot(rootElement);
console.log('🎭 Rendering App component...');
root.render(
Error: ${error instanceof Error ? error.message : 'Unknown error'}
Refreshing automatically in 3 seconds...