diff --git a/dev-packages/e2e-tests/test-applications/lighthouse-react/src/main.tsx b/dev-packages/e2e-tests/test-applications/lighthouse-react/src/main.tsx index 8ba6db3c8685..706d00c80126 100644 --- a/dev-packages/e2e-tests/test-applications/lighthouse-react/src/main.tsx +++ b/dev-packages/e2e-tests/test-applications/lighthouse-react/src/main.tsx @@ -1,20 +1,24 @@ +import * as Sentry from '@sentry/react'; import { createRoot } from 'react-dom/client'; import App from './App'; -async function bootstrap() { - const mode = import.meta.env.MODE; - if (mode === 'init-only') { - const { initSentry } = await import('./sentry/init-only'); - initSentry(); - } else if (mode === 'tracing-replay') { - const { initSentry } = await import('./sentry/tracing-replay'); - initSentry(); - } - // 'no-sentry' mode: do not import any sentry module — the dynamic-import - // branches above are unreachable and Vite drops them from the bundle. - - const root = createRoot(document.getElementById('root')!); - root.render(); +if (import.meta.env.MODE === 'tracing-replay') { + Sentry.init({ + dsn: import.meta.env.VITE_E2E_TEST_DSN as string | undefined, + release: 'lighthouse-fixture', + environment: 'qa', + integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()], + tracesSampleRate: 1.0, + replaysSessionSampleRate: 1.0, + replaysOnErrorSampleRate: 1.0, + }); +} else if (import.meta.env.MODE === 'init-only') { + // enabled: false makes the SDK a guaranteed no-op (no transport allocation, + // no DSN warning). We're measuring pure SDK-loading + tree-shaking cost. + Sentry.init({ enabled: false }); } +// 'no-sentry' mode: both branches above are statically dead, so Vite drops +// the @sentry/react import entirely from the bundle. -void bootstrap(); +const root = createRoot(document.getElementById('root')!); +root.render(); diff --git a/dev-packages/e2e-tests/test-applications/lighthouse-react/src/sentry/init-only.ts b/dev-packages/e2e-tests/test-applications/lighthouse-react/src/sentry/init-only.ts deleted file mode 100644 index 572d2c93e106..000000000000 --- a/dev-packages/e2e-tests/test-applications/lighthouse-react/src/sentry/init-only.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as Sentry from '@sentry/react'; - -export function initSentry(): void { - // enabled: false makes the SDK a guaranteed no-op (no transport allocation, - // no DSN warning). We're measuring pure SDK-loading + tree-shaking cost. - Sentry.init({ enabled: false }); -} diff --git a/dev-packages/e2e-tests/test-applications/lighthouse-react/src/sentry/no-sentry.ts b/dev-packages/e2e-tests/test-applications/lighthouse-react/src/sentry/no-sentry.ts deleted file mode 100644 index 5610cfa61cfc..000000000000 --- a/dev-packages/e2e-tests/test-applications/lighthouse-react/src/sentry/no-sentry.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function initSentry(): void { - // no-op: this mode intentionally excludes all Sentry imports -} diff --git a/dev-packages/e2e-tests/test-applications/lighthouse-react/src/sentry/tracing-replay.ts b/dev-packages/e2e-tests/test-applications/lighthouse-react/src/sentry/tracing-replay.ts deleted file mode 100644 index 137636604e59..000000000000 --- a/dev-packages/e2e-tests/test-applications/lighthouse-react/src/sentry/tracing-replay.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as Sentry from '@sentry/react'; - -export function initSentry(): void { - Sentry.init({ - dsn: import.meta.env.VITE_E2E_TEST_DSN as string | undefined, - release: 'lighthouse-fixture', - environment: 'qa', - integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()], - tracesSampleRate: 1.0, - replaysSessionSampleRate: 1.0, - replaysOnErrorSampleRate: 1.0, - }); -}