sentry-javascript
sentry-javascript copied to clipboard
Add @sentry/react to CDN
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.
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.
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 🥀
We use Rspack with the swc-loader. I don't know when I'll get a chance to look at this again.
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 🥀