import React from 'react'; import { createRoot } from 'react-dom/client'; // FIX: The original error was because App.tsx had no default export. While fixing that, this path is made more explicit. import App from './App.tsx'; const rootElement = document.getElementById('root'); if (!rootElement) { throw new Error("Could not find root element to mount to"); } // Register Firebase Messaging Service Worker for push notifications if ('serviceWorker' in navigator) { // PERMANENT FIX: Use an absolute path and explicitly define the scope to '/'. // This robustly resolves the "Scope URL is not same-origin" error by ensuring // the service worker controls the entire application from the root. navigator.serviceWorker.register('/firebase-messaging-sw.js', { scope: '/' }) .then((registration) => { console.log('Service Worker registration successful, scope is:', registration.scope); }).catch((err) => { console.log('Service Worker registration failed:', err); }); } const root = createRoot(rootElement); root.render( );