Skip to content

@sentry/replay cannot be lazily loaded #10793

@balavishnu-hme

Description

@balavishnu-hme

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react

SDK Version

7.102.0

Framework Version

18.2.0

Link to Sentry event

No response

SDK Setup

Sentry.init({
dsn: SENTRY_DSN,
environment,
release,
integrations: [Sentry.reactRouterV6BrowserTracingIntegration({
useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes,
})]
});

Steps to Reproduce

  1. Install @sentry/react
  2. Do not enable replay

@sentry/replay adds ~300kb of JS in initial load itself, since we want sentry to start as soon as possible. But we aren't using replay as of now or it can be started lazily.

Sentry docs provide a way to lazy initiate replay, but then it is already part of the bundle.
https://docs.sentry.io/platforms/javascript/guides/svelte/session-replay/#lazy-loading-replay

Expected Result

Replay shouldn't be in the bundle.

Actual Result

Replay should only be part of the bundle if it is being used, or give a way to opt out from replay.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions