Re-examine usage of sentry-cli and bundler plugins
See original GitHub issueProblem Statement
https://github.com/getsentry/sentry-javascript/issues/4894#issuecomment-1193216873 brings up sentry-cli
size issues.
Essentially, due to sentry-cli
’s binary size, we require users to have some kind of bundling setup to make sure that they tree shake away sentry-cli
in application code.
Is there a way we can improve this situation?
There’s also the concern here with bundlers. Right now we only have a single 1st party plugin, for webpack: https://github.com/getsentry/sentry-webpack-plugin
There is also a community vite plugin:
The more bundlers we support, the better the out of the box experience is (less finagling with sentry-cli
).
Solution Brainstorm
Sentry-cli usage
My musings from slack for the sentry-cli size problem:
- Produce a minimized version of
sentry-cli
that pretty much only exposes the API around sourcemaps/releases - Expand the amount of bundler plugins we have, (go from just webpack -> rollup, webpack, vite, esbuild, we know how to do this)
- Make sure the framework SDKs include a bundler plugin, and those bundler plugins only use the minimal sentry-cli.
Another option here is that we can try making adding build time plugins/steps a Step 2 in the onboarding wizard (after
yarn add
andSentry.init
). Mobile has something similar where you need to explicitly add the gradle plugin for Android for ex.
Note: We’ll need to DACI how exactly we make sentry-cli smaller, basically choose between re-writing the needed functionality in JS vs. stripping the CLI rust binary at compile time.
Bundlers
There is https://github.com/unjs/unplugin, which allows us to have a single codebase for bundlers (perhaps in the SDK monorepo 👀). It also uses the rollup plugin API, which @lobsterkatie does have a lot of experience with.
@asonnleitner did some awesome work with https://github.com/asonnleitner/unplugin-sentry as per https://github.com/getsentry/sentry-javascript/discussions/4989. We can def use that as a starting point!
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:7 (7 by maintainers)
Top GitHub Comments
If we proceed with https://github.com/unjs/unplugin, we’ll go in knowing we have to contribute back upstream - maybe we can fix those inconsistencies?
If this were done as a proverbial
Pick<sentry-cli, 'releases' | 'sourcemaps'>
rather than anOmit<sentry-cli, 'all' | 'of' | 'the' | 'other' | 'many' | 'commands'>
, I don’t see why it would grow significantly over time.I’m not philosophically against your translate-everything-to-js idea, but it does seem like it’d be more work (and more maintenance) than just wrapping a stripped-down cli tool.