diff --git a/desktop/src/main.tsx b/desktop/src/main.tsx
index 41fc67cb4..301c15504 100644
--- a/desktop/src/main.tsx
+++ b/desktop/src/main.tsx
@@ -4,9 +4,10 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { App } from "@/app/App";
import "@/shared/styles/globals.css";
import { ThemeProvider } from "@/shared/theme/ThemeProvider";
-import { maybeInstallE2eTauriMocks } from "@/testing/e2eBridge";
-maybeInstallE2eTauriMocks();
+type E2eWindow = Window & {
+ __SPROUT_E2E__?: unknown;
+};
const queryClient = new QueryClient({
defaultOptions: {
@@ -22,12 +23,32 @@ const queryClient = new QueryClient({
},
});
-ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
-
-
-
-
-
-
- ,
-);
+function renderApp() {
+ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
+
+
+
+
+
+
+ ,
+ );
+}
+
+async function installE2eBridgeIfConfigured() {
+ // Keep the large E2E bridge out of the normal startup path and production
+ // bundle; only load it when tests explicitly inject an E2E config.
+ if (!(window as E2eWindow).__SPROUT_E2E__) {
+ return;
+ }
+
+ const { maybeInstallE2eTauriMocks } = await import("@/testing/e2eBridge");
+ maybeInstallE2eTauriMocks();
+}
+
+async function bootstrap() {
+ await installE2eBridgeIfConfigured();
+ renderApp();
+}
+
+void bootstrap();