Skip to content
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

build(replay): Provide full browser+tracing+replay bundle #6793

Merged
merged 4 commits into from
Jan 17, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented Jan 16, 2023

Adds another CDN bundle bundle.tracing.replay.js which includes both tracing and replay.

@mydea mydea added the Package: replay Issues related to the Sentry Replay SDK label Jan 16, 2023
@mydea mydea requested a review from Lms24 January 16, 2023 14:23
@mydea mydea self-assigned this Jan 16, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.82 KB (-0.01% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 61.44 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.49 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.74 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.22 KB (0%)
@sentry/browser - Webpack (minified) 66.17 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.24 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.51 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.73 KB (+0.02% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.01 KB (-0.02% 🔽)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.12 KB (-0.81% 🔽)
@sentry/replay - Webpack (gzipped + minified) 38.45 KB (-0.99% 🔽)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.33 KB (added)

@mydea mydea force-pushed the fn/replay-full-bundle branch 2 times, most recently from 20272b7 to 7265349 Compare January 16, 2023 14:57
@mydea mydea force-pushed the fn/replay-full-bundle branch from 7265349 to 77c2dc0 Compare January 16, 2023 15:40
@mydea mydea marked this pull request as ready for review January 16, 2023 15:43
replace({
preventAssignment: true,
values: {
__SENTRY_REPLAY_VERSION__: JSON.stringify(pkg.version),
Copy link
Member Author

Choose a reason for hiding this comment

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

Reminder to ourselves: In the next version, we should get rid of this. By now all docs etc. point to importing replay directly from @sentry/browser, so this should always be in sync.

Copy link
Member

Choose a reason for hiding this comment

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

Can we document this here #5194 or in a new issue?

Copy link
Member

Choose a reason for hiding this comment

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

Oh wait you mean next version of the SDK, not next major version. Ignore me!

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this needs to be in a major release. We're tracking this in #6366


import * as Sentry from './index.bundle';

Sentry.Integrations.Replay = Replay;
Copy link
Member Author

Choose a reason for hiding this comment

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

It was the easiest/cleanest way I could find to handle this in a dedicated input file. Otherwise it gets quite messy when trying to do this inside of index.bundle.ts 😬

Copy link
Member Author

Choose a reason for hiding this comment

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

Note: This means we only have a single default export here, and can't do our usual import * as Sentry stuff. but since we only use this to generate the bundle, and there it works as expected, I'd say that's fine?

Copy link
Member

Choose a reason for hiding this comment

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

I think this is fine and with this change, the full CDN bundle usage is identical to the addon bundle (docs).

@mydea mydea force-pushed the fn/replay-full-bundle branch 2 times, most recently from 29d3018 to f9bd33c Compare January 16, 2023 16:54
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Looks good! I wanna go over this tomorrow again to double check I didn't miss anything but great work!

Comment on lines -101 to -114
src="https://browser.sentry-cdn.com/7.24.1/bundle.tracing.min.js"
crossorigin="anonymous"
></script>

// Replay integration bundle
<script
src="https://browser.sentry-cdn.com/7.24.1/replay.min.js"
Copy link
Member

Choose a reason for hiding this comment

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

l: Hmm it probably makes sense to show the full CDN bundle here but I'd like to keep the addon bundle around and documented (at least in docs) as I think some people might prefer it 🤔 Especially, if we're considering using the loader to lazy load it in the future.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm yeah, I guess the reason to use it is if you want replay but not tracing - fair! I can add both somehow - probably leave the "full" bundle on top and add a section below on standalone usage.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added another section below 👍


import * as Sentry from './index.bundle';

Sentry.Integrations.Replay = Replay;
Copy link
Member

Choose a reason for hiding this comment

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

I think this is fine and with this change, the full CDN bundle usage is identical to the addon bundle (docs).

@mydea mydea force-pushed the fn/replay-full-bundle branch from f9bd33c to f5ec17a Compare January 17, 2023 08:54
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Ok, double checked and I think this looks good 🚀
Also checked that we're uploading this as an artifact on release branches ✅

// Replay integration bundle
<script
src="https://browser.sentry-cdn.com/7.24.1/replay.min.js"
src="https://browser.sentry-cdn.com/7.31.0/bundle.tracing.replay.min.js"
Copy link
Member

Choose a reason for hiding this comment

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

Can't comment there directly but:
L95-96: Let's remove the text as this doesn't apply anymore if we tell them in this snippet to use the full bundle.

@mydea mydea force-pushed the fn/replay-full-bundle branch from f5ec17a to 53c298b Compare January 17, 2023 10:04
@mydea mydea enabled auto-merge (squash) January 17, 2023 10:04
@mydea mydea merged commit 660d4bb into master Jan 17, 2023
@mydea mydea deleted the fn/replay-full-bundle branch January 17, 2023 10:28
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