If you set these to true at build time, it will replace the regular ShadowDomManager / CanvasManager / IframeManager with a noop variant of these managers.
All of these together shave off about 8 KB gzipped from our replay bundles, if set to true.
For now, we'll probably keep this enabled by default, but at least we have a path for users to shake this out if they don't need these features.
Note: I played with some other approaches, e.g. instead of having the noop class make these e.g. iframeManager: IframeManager | undefined, but I think overall the code to guard against using this everywhere ends up being a similar amount of bytes, plus we need to spread this much more through the codebase, making rebasing on upstream master etc. potentially harder. This way, IMHO it should be the easiest way to keep this as contained as possible.
Note 2: In scenarios where you do not set the build flags at all (so neither to true or false), this will actually slightly increase the bundle size 😬 but it's a very tiny increase which is OK I'd say.
This PR adds 3 new build flags to rrweb:
__RRWEB_EXCLUDE_CANVAS__
__RRWEB_EXCLUDE_SHADOW_DOM__
__RRWEB_EXCLUDE_IFRAME__
If you set these to
true
at build time, it will replace the regularShadowDomManager
/CanvasManager
/IframeManager
with a noop variant of these managers.All of these together shave off about 8 KB gzipped from our replay bundles, if set to
true
.For now, we'll probably keep this enabled by default, but at least we have a path for users to shake this out if they don't need these features.
Note: I played with some other approaches, e.g. instead of having the noop class make these e.g.
iframeManager: IframeManager | undefined
, but I think overall the code to guard against using this everywhere ends up being a similar amount of bytes, plus we need to spread this much more through the codebase, making rebasing on upstream master etc. potentially harder. This way, IMHO it should be the easiest way to keep this as contained as possible.Note 2: In scenarios where you do not set the build flags at all (so neither to true or false), this will actually slightly increase the bundle size 😬 but it's a very tiny increase which is OK I'd say.