-
-
Notifications
You must be signed in to change notification settings - Fork 343
Huge bundle size in react-native for sentry/react-native (264kb) #1818
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
Comments
Sentry team can treeshake in react native with require + try/catch. Dev dependencies should not be imported and should be behind an env var for imports. |
@jayshah123 is 264kb before or after treeshake?
|
Metro does not have treeshaking as far as I know |
Treeshaking in metro is not automatic but can be done manually with require + try/catch. if you ever import a dev dependency you must treeshake it or else you will bloat the production bundle with a bunch of useless code. For instance, this is how you can treeshake reactotron: if (__DEV__) {
try {
const Reactotron = require('reactotron-react-native');
Reactotron.configure() // controls connection & communication settings
.useReactNative() // add all built-in react native plugins
.connect(); // let's connect!
} catch (e) {}
} |
dup of #1733 |
Environment
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
sentry-react-native 3.0.0
React native 0.63.2
Steps to Reproduce
npx react-native-bundle-visualizer
in a project that containssentry/react-native
Expected Result
Smaller bundle size, I see packages like browser etc included which would probably not be needed.
Actual Result
264kb bundle
The text was updated successfully, but these errors were encountered: