Skip to content
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

Use of "@sentry/integrations" causes unnecessary files being added to the bundle #759

Closed
grabbou opened this issue Feb 11, 2020 · 4 comments

Comments

@grabbou
Copy link

grabbou commented Feb 11, 2020

Hey,

First of all, apologies if this is not an issue or not a suitable place to raise it. In this case, feel free to close it and let me know how to follow up.

I am debugging the end bundle of an application that uses Sentry and React Native integration and I have noticed that there are Angular, Ember and Vue integrations included in the resulting bundle.

After digging deeper, it looks like they are present in the entry file of @sentry/integrations that is loaded when we require RewriteFrames.

Wouldn't it be more suitable to move that function to @sentry/utils? I don't find this particularly disturbing, but just figured I'd share this here as it was really surprising to see other frameworks being referenced in the code and find out where they're coming from.

@HazAT
Copy link
Member

HazAT commented Feb 12, 2020

Thanks for reporting, this is definitely not intended.
hmmm that seems odd, we can't move those integrations there but I thought the bundler removes files that are not referenced in the code (treeshaking).
I wonder if it's because of how we import @sentry/integrations when I find some time I will try to repro and fix this, if you have any hints in the meantime, please let us know.

@marandaneto
Copy link
Contributor

marandaneto commented Jan 20, 2022

React Native/Metro does not support tree shaking, not sure how we can tackle this.
See facebook/metro#227 (comment)

@AbhiPrasad @bruno-garcia @jennmueng ideas?

Edit: After getsentry/sentry-javascript#4240 is done, this is likely going to be improved since the integrations package will be reworked.

@marandaneto
Copy link
Contributor

@AbhiPrasad opened a PR that may help us out with that, getsentry/sentry-javascript#4434

@marandaneto
Copy link
Contributor

There were a few improvements related to bundle size and integrations on the JS SDK, the RN SDK got it for free, please upgrade to the latest version (4.x) and let us know if that helped, thanks.

Repository owner moved this from Blocked to Done in Mobile & Cross Platform SDK Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants