Skip to content

feat(bundles): Ensure CDN bundles always have a Replay export#7414

Merged
mydea merged 6 commits intodevelopfrom
fn/replay-mock-export
Mar 14, 2023
Merged

feat(bundles): Ensure CDN bundles always have a Replay export#7414
mydea merged 6 commits intodevelopfrom
fn/replay-mock-export

Conversation

@mydea
Copy link
Copy Markdown
Member

@mydea mydea commented Mar 10, 2023

This makes sure we export Replay in CDN bundles that do not include the actual Replay code.
This will export a minimal shim that covers the public API we have, and logs a message.

If we think that's good, we can look to use a similar approach for BrowserTracing (TBD - this is a bit different, but let's see).

Nicely, we can actually cover this quite well with our playwright tests 🎉

Closes #7393

@mydea mydea added the Package: replay Issues related to the Sentry Replay SDK label Mar 10, 2023
@mydea mydea requested review from AbhiPrasad and Lms24 March 10, 2023 15:04
@mydea mydea self-assigned this Mar 10, 2023
Copy link
Copy Markdown
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.

Generally this LGTM. I think the build error is related to the tracing bundle not being able to resolve the relative path to the shim file.

I guess the one downside here is that this increases the bundle size of the non-replay bundles somewhat unnecessarily. But I understand that this is the lesser of two evils 😅

@mydea mydea force-pushed the fn/replay-mock-export branch 2 times, most recently from a16ebe8 to 2b85800 Compare March 13, 2023 15:03
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 13, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.4 KB (+0.71% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 63.27 KB (+0.47% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.98 KB (+0.51% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 56.18 KB (+0.53% 🔺)
@sentry/browser - Webpack (gzipped + minified) 20.64 KB (0%)
@sentry/browser - Webpack (minified) 67.41 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.66 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 48.55 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 27.64 KB (+0.44% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.91 KB (+0.52% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.17 KB (0%)
@sentry/replay - Webpack (gzipped + minified) 37.19 KB (0%)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 61.2 KB (+0.01% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 54.37 KB (+0.01% 🔺)

@mydea mydea force-pushed the fn/replay-mock-export branch from 2b85800 to bd507e8 Compare March 13, 2023 15:27
@mydea mydea force-pushed the fn/replay-mock-export branch from bd507e8 to 2968e20 Compare March 13, 2023 15:54
@mydea mydea merged commit 4bff5a9 into develop Mar 14, 2023
@mydea mydea deleted the fn/replay-mock-export branch March 14, 2023 09:29
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.

Export Replay shim in CDN bundle to avoid breaking in loader

3 participants