sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Add @sentry/react to CDN

Open steinybot opened this issue 1 year ago • 1 comments

Problem Statement

We want to be able to use @sentry/react from the CDN

Solution Brainstorm

Add @sentry/react to the CDN.

We tried using the one from NPM but it blew out our bundle size by a lot. We tried the various https://docs.sentry.io/platforms/javascript/configuration/tree-shaking/ and we couldn't even get @sentry/core remotely close to the minified version on the CDN.

steinybot avatar Jun 26 '24 00:06 steinybot

How do you build your app? What sizes are you getting for the npm package? Running Sentry via npm should actually have a (slightly) smaller bundle size impact than from CDN, but it requires you to bundle/build it yourself. We publish bundle size stats with each release: https://github.com/getsentry/sentry-javascript/releases/tag/8.12.0

Base @sentry/react importing only init and ErrorBoundary comes to <25 kb (gzipped), while the CDN bundle comes to ~23.5 kb - but that does not include the error boundary. If you omit that, the npm package should be smaller than the CDN bundle.

mydea avatar Jun 26 '24 07:06 mydea

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Aug 09 '24 07:08 getsantry[bot]

We use Rspack with the swc-loader. I don't know when I'll get a chance to look at this again.

steinybot avatar Aug 11 '24 23:08 steinybot

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Sep 03 '24 07:09 getsantry[bot]