Skip to content

ref(replay): Extract worker into dedicated package #7139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 14, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented Feb 10, 2023

This supersedes #6665 and extracts part of #7025.

This moves the worker into a dedicated (private) @sentry-internal/replay-worker package. For now, this still builds the worker the same way as before (as a string).

It also adds the new compress() stateless function, but doesn't use it yet.

@mydea mydea added the Package: replay Issues related to the Sentry Replay SDK label Feb 10, 2023
@mydea mydea requested review from billyvg and Lms24 February 10, 2023 11:48
@mydea mydea self-assigned this Feb 10, 2023
@mydea
Copy link
Member Author

mydea commented Feb 10, 2023

Note: I've actually extracted the code to get the worker URL into the worker package. This way, we should be able to do any refactorings/experimentation etc. purely in that package, and replay itself doesn't really care what worker type you use, it just wants to get the appropriate URL and use it, done.

This is the build output:
image

Where worker.js still exports the string, and index.js is just the vendor/index.js file.

@@ -0,0 +1,6 @@
import workerString from './worker';
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if vendor is the best name, but these are basically pre-built files.
We need this because workerString is built by rollup at build-time, so we can't reference it at dev-time. I figured this is simple enough code to just pipe this through without any build step for now.

Note that this is transparent for the replay package, it doesn't really care about how we build stuff here.

Copy link
Member

Choose a reason for hiding this comment

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

static? not sure if that's any better

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll just merge it as vendor for now and we can revisit this later, this is purely internal anyhow.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.07 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 62.2 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.7 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified) 55.34 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.43 KB (0%)
@sentry/browser - Webpack (minified) 66.78 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.46 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.88 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 27.02 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.28 KB (0%)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 42.51 KB (+0.05% 🔺)
@sentry/replay - Webpack (gzipped + minified) 36.67 KB (-0.6% 🔽)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.22 KB (+0.03% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 53.75 KB (+0.03% 🔺)

Copy link
Member

@billyvg billyvg left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -0,0 +1,6 @@
import workerString from './worker';
Copy link
Member

Choose a reason for hiding this comment

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

static? not sure if that's any better

@mydea mydea force-pushed the fn/replay-worker-package branch from 89130d5 to 201fad3 Compare February 14, 2023 08:17
@mydea mydea merged commit f993317 into develop Feb 14, 2023
@mydea mydea deleted the fn/replay-worker-package branch February 14, 2023 09:49
ramchaik pushed a commit to ramchaik/sentry-javascript that referenced this pull request Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: replay Issues related to the Sentry Replay SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants