Description
Summary
Hi team 👋
We’re currently using @newrelic/browser-agent in a production app shell architecture and trying to reduce our initial bundle size.
Even when configuring a slimmed down Agent
using guidance in the README, excluding Session Replay and even just creating a blank Agent
with no features passed in - I can see the final bundle still includes the full rrweb library. This adds ~500 KB parsed (150–200 KB gzipped) to our critical path.
This results in rrweb being included in the bundle regardless of whether session replay is used or enabled. Tree shaking cannot eliminate potentially due to static import structure internally within the agent.
Desired Behavior
Using the Agent
to explicitly compose features should result in only those features being bundled. If SessionReplay
is not imported or registered, rrweb
should not be included in the output bundle.
Possible Solution
Additional context
We’re trying to keep our app shell lean and performant. Currently, New Relic contributes the largest chunk of our bundle size, and rrweb
(which we don’t use) accounts for a significant portion of that.
Thanks 🙏