Skip to content

build(replay): Improve replay-worker build#7173

Merged
mydea merged 1 commit intodevelopfrom
fn/replay-worker-improve-build
Feb 14, 2023
Merged

build(replay): Improve replay-worker build#7173
mydea merged 1 commit intodevelopfrom
fn/replay-worker-improve-build

Conversation

@mydea
Copy link
Copy Markdown
Member

@mydea mydea commented Feb 14, 2023

This changes the build for the replay worker:

  • Ensure that build:transpile and build:types are actually separate things, to avoid conflicts
  • Ensure we do not rely on copying vendor stuff as-is, but relying on rollup

Basically, we now keep the worker in _worker.ts, while worker.ts is just a placeholder that is replaced at built time with the string-wrapped & resolved version of _worker.ts. This way, the imports etc. work as expected, and we can actually generate the types normally.

I also aligned the build structure with other packages, the output is now:

image

While index.js is:

import r from"./worker";function e(){const e=new Blob([r]);return URL.createObjectURL(e)}export{e as getWorkerURL};

and worker.js is:

export default `/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
function t(t){let e=t.length;......

@mydea mydea added the Package: replay Issues related to the Sentry Replay SDK label Feb 14, 2023
@mydea mydea self-assigned this Feb 14, 2023
Copy link
Copy Markdown
Contributor

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

Nice, I like this approach!

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.09 KB (+0.06% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 62.23 KB (+0.03% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.71 KB (+0.06% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 55.37 KB (+0.04% 🔺)
@sentry/browser - Webpack (gzipped + minified) 20.44 KB (+0.03% 🔺)
@sentry/browser - Webpack (minified) 66.81 KB (+0.03% 🔺)
@sentry/react - Webpack (gzipped + minified) 20.47 KB (+0.03% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.9 KB (+0.02% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 27.03 KB (+0.04% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.29 KB (+0.05% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 42.51 KB (+0.06% 🔺)
@sentry/replay - Webpack (gzipped + minified) 36.67 KB (-0.6% 🔽)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.23 KB (+0.04% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 53.77 KB (+0.05% 🔺)

@mydea mydea merged commit 8a29725 into develop Feb 14, 2023
@mydea mydea deleted the fn/replay-worker-improve-build branch February 14, 2023 12:25
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.

2 participants