Skip to content

build(replay): Use Monorepo's rollup config to build Replay #6343

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 16 commits into from
Nov 30, 2022

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Nov 30, 2022

This PR updates Replay's build config to use our monorepo's rollup config for building and transpiling the Replay integration. With this PR, we're introducing a breaking change because the tarball structure is going to change. However, this only breaks users who imported from package-internal paths directly and not from the top-level package.

More specifically, these are the changes:

  • Move and rename./config/rollup.config.core.ts to ./rollup.npm.config.js which now uses our makeNPMConfigVariants and makeBaseNPMConfig rollup config helper functions to create ESM and CJS transpiled JS, just like in all our other packages. For now we have to change this to JavaScript but we can ofc revisit having TS-based rollup configs in the future.
    • Instead of bundling everything into the index.js files, this config now just transpiles the individual modules. This is how we do it in all our other packages. We might have to revisit this strategy for vendoring rrweb and bundling but we can build on top of this PR to do so.
  • Move and rename ./config/rollup.worker.config.ts to ./rollup.worker.config.js (no changes)
  • Update eslint configs
  • Fix a few type errors I came across while performing these build changes
  • Update package.json scripts so that they are in line with the scripts of our other packages. This should simplify the scripts a little.
  • Revert fix(replay): Temporarily build Replay after other packages #6307 as we now transpile and check/build types separately, like we do with the rest of our packages.
  • Revert fix(replay): Temporarily replace __DEBUG_BUILD__ with true #6341 as the__SENTRY_DEBUG__ flag is now set in our rollup helper functions

Besides executing unit tests and manually inspecting the transpiled output, I also tested these changes with a plain-js test app and it still seems to work.

ref: #6280

@github-actions
Copy link
Contributor

github-actions bot commented Nov 30, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.57 KB (-0.02% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 60.59 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.36 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.15 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.12 KB (0%)
@sentry/browser - Webpack (minified) 65.75 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.14 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 45.99 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.44 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.88 KB (+0.02% 🔺)
@sentry/replay index.js 37.28 KB (-39.96% 🔽)
@sentry/replay - Webpack (gzipped + minified) 37.25 KB (-40% 🔽)
@sentry/replay - Webpack (minified) 125.1 KB (-37.4% 🔽)

@Lms24 Lms24 force-pushed the lms-replay-build-rollup branch from bea29c4 to 33fd89f Compare November 30, 2022 13:08
@Lms24 Lms24 force-pushed the lms-replay-build-rollup branch from 33fd89f to a93cd23 Compare November 30, 2022 13:24
@Lms24 Lms24 marked this pull request as ready for review November 30, 2022 14:38
@Lms24 Lms24 requested review from mydea and billyvg November 30, 2022 14:38
@Lms24 Lms24 added Dev: Build Package: replay Issues related to the Sentry Replay SDK labels Nov 30, 2022
Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

AMAZING! Great work, this will simplify everything going forward 🎉

@Lms24 Lms24 merged commit 15b344f into master Nov 30, 2022
@Lms24 Lms24 deleted the lms-replay-build-rollup branch November 30, 2022 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dev: Build Package: replay Issues related to the Sentry Replay SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants