getsentry / rrweb

record and replay the web
https://www.rrweb.io/
Other
9 stars 5 forks source link

feat: Bundle canvas worker manually #144

Closed mydea closed 7 months ago

mydea commented 7 months ago

While trying to get the ReplayCanvas integration to properly tree shake, I noticed that the current way this worker is built is not ideal, and maybe is not treeshakeable properly. We use a rollup plugin to convert the worker to a base64 string, which a) is more verbose than just having the worker be a plain string, and b) possibly is not tree shakeable.

This refactors the worker to work the same way as the compression worker in Sentry - we build it to a string and use that in rrweb. This is a bit more complicated, from a setup perspective, but gives us full control over the worker build.

github-actions[bot] commented 7 months ago

size-limit report 📦

Path Size
rrweb - record only (gzipped) 16.57 KB (0%)
rrweb - record & getCanvasManager only (gzipped) 19.11 KB (-9.49% 🔽)
rrweb - record only (min) 56.53 KB (0%)
rrweb - record with treeshaking flags (gzipped) 15.35 KB (0%)
mydea commented 7 months ago

Tracking this upstream as well: https://github.com/rrweb-io/rrweb/issues/1376