Skip to content

fix: don't bundle everything into console recorder#1594

Closed
pauldambra wants to merge 19 commits intorrweb-io:masterfrom
PostHog:fix/console-bundle-size
Closed

fix: don't bundle everything into console recorder#1594
pauldambra wants to merge 19 commits intorrweb-io:masterfrom
PostHog:fix/console-bundle-size

Conversation

@pauldambra
Copy link
Contributor

@pauldambra pauldambra commented Nov 2, 2024

before after
before Screenshot 2024-11-03 at 00 13 35

the use of utils.patch from rrweb in the console plugin was including the whole of rrweb in the console recorder.

move the patch function into the existing @rrweb/utils package fixes this

(I've only proven the bundle is fixed - i'm hoping CI proves the recorder still works 😅 )

just looking at bundle size this reduces the console recorder plugin from 255kb to 15kb

@changeset-bot
Copy link

changeset-bot bot commented Nov 2, 2024

🦋 Changeset detected

Latest commit: 9592411

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
@rrweb/rrweb-plugin-console-record Patch
rrweb Patch
@rrweb/utils Patch
rrweb-snapshot Patch
rrdom Patch
rrdom-nodejs Patch
rrweb-player Patch
@rrweb/all Patch
@rrweb/replay Patch
@rrweb/record Patch
@rrweb/types Patch
@rrweb/packer Patch
@rrweb/web-extension Patch
rrvideo Patch
@rrweb/rrweb-plugin-console-replay Patch
@rrweb/rrweb-plugin-sequential-id-record Patch
@rrweb/rrweb-plugin-sequential-id-replay Patch
@rrweb/rrweb-plugin-canvas-webrtc-record Patch
@rrweb/rrweb-plugin-canvas-webrtc-replay Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -1,7 +1,7 @@
import type { listenerHandler, RecordPlugin, IWindow } from '@rrweb/types';
import { utils } from 'rrweb';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the fix here... this line was including the whole of rrweb

Copy link
Member

@Juice10 Juice10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good @pauldambra, I had a couple tweaks, mainly due to the release of rrweb 2.0.0-alpha.18
But as soon as they are tackled we can merge this one and do another release.
FYI: You might have to pull in master to fix the tests, after adding the suggestions.

pauldambra and others added 5 commits December 6, 2024 23:01
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
@pauldambra
Copy link
Contributor Author

yuck, I tried to be clever and as always that backfired... i'll recreate this PR from a person fork 🫠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants