diff --git a/src/main.tsx b/src/main.tsx index 887f34f..8ce3ce7 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -8,11 +8,12 @@ import App from './App.tsx'; import './index.css'; // Hide Capacitor splash screen once JS is ready -// Must be called manually when autoHide: false (or as a safety net) +// Uses the global Capacitor object to avoid a hard dependency on the package if (typeof window !== 'undefined') { - import('@capacitor/splash-screen').then(({ SplashScreen }) => { - SplashScreen.hide().catch(() => {/* not in Capacitor context */}); - }).catch(() => {/* web build - no Capacitor */}); + const cap = (window as unknown as { Capacitor?: { Plugins?: { SplashScreen?: { hide: () => Promise } } } }).Capacitor; + if (cap?.Plugins?.SplashScreen) { + cap.Plugins.SplashScreen.hide().catch(() => {}); + } } // Outfit font for body text