-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(replay): Extract worker into @sentry-internal/replay-worker
#6665
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
Conversation
size-limit report 📦
|
Instead of creating an entirely new package could we instead clean this worker thing up as a whole?:
|
The problem with that is that we need the function to be transpiled, as it will be loaded as-is. I've explored ways to make it work with actually importing the module (not as a string), but so far found no way to make this work with jsdom, sadly :( I'll give it another try, we changed a few build things, but my hopes are slim. |
Note that we may even want to publish this to the CDN so that we can load the worker from a remote url. We have users that cannot use the worker due to CSP (can't load blobs). |
Yeah, that's also a thought I had, but this will also probably not be OK for other users (who do not want/can load stuff from external URLs outside of their direct control). So this would need to be an opt-in thing, I guess. FYI I've also explored various other ways to inline workers with rollup, but none of them worked so far (the nice ones are esm only, and do not support cjs. others are not supported by jest/jsdom, ...) |
Yeah I think opt-in, but I think users would be willing to allow our CDN host sooner than allowing blobs. |
I'm 👍 on merging this -- currently we don't have automation to ensure that our worker bundle is not stale. If you modify the worker, you would need to build and commit the worker bundle. |
Closes in favor of #7139 |
Currently, we have multiple rollup jobs in @sentry/replay, one for the worker (which is needed even at dev time), and one for the actual replay package. This is not ideal and leads to the build behaving differently from other packages.
This PR extracts the worker into a
@sentry-internal/replay-worker
package, which is private (=not published to NPM). It builds a single file, which is the worker in string form (plus a type file). Then, in @sentry/replay we can simply consume this package.The main downside is that we have another package, but I believe that it is worth it for clarity in this case.
I have checked e.g. the @sentry-internal/node-integration-tests package as comparison, and it seems I don't need to do anything but set
private: true
in package.json to ensure we do not publish this anywhere? Let me know if that's not correct 😅Closes #6371