sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Optimization problem with @sentry/react-native within a react-native-web app - lodash gots fully imported

Open kopax-polyconseil opened this issue 2 years ago • 3 comments

OS:

  • [x] Windows
  • [x] MacOS
  • [x] Linux

Platform:

  • [x] iOS
  • [x] Android

SDK:

  • [x] @sentry/react-native (>= 1.0.0)
  • [ ] react-native-sentry (<= 0.43.2)

SDK version: 4.2.2

react-native version: 0.68.2

Are you using Expo?

  • [ ] Yes
  • [x] No

Are you using sentry.io or on-premise?

  • [ ] sentry.io (SaaS)
  • [x] on-premise 22.5.0

Configuration:


I have following issue:

We use lodash.* do target exactly which module we need from lodash, but after buildeing our react-native-web app (which is also a react-native app), it appears looking at webpack-bundle-analyzer that one of our dependency (which is sentry-react-native) import the whole lodash. Is this necessary ?

image

see in red the multiple lodash we have now

Steps to reproduce:

  • yarn add @sentry/react-native
  • npm ls lodash

Actual result:

├─┬ @sentry/[email protected]
│ └─┬ @sentry/[email protected]
│   ├─┬ [email protected]
│   │ └── [email protected] deduped
│   └── [email protected] deduped

Expected result:

├─┬ @sentry/[email protected]
│ └─┬ @sentry/[email protected]
│   ├─┬ [email protected]
│   │ └── [email protected]
│   └── [email protected]

Related issues

  • https://stackoverflow.com/questions/73222347/why-webpack-bundle-analyzer-show-lodash-bundled-more-than-once
  • https://github.com/getsentry/sentry-wizard/issues/182

kopax-polyconseil avatar Aug 03 '22 14:08 kopax-polyconseil

Also, I do see that https://www.npmjs.com/package/inquirer is a cli tool, what's the point of shipping it into our iOS/Android app ? Could this dependence be removed?

kopax-polyconseil avatar Aug 03 '22 14:08 kopax-polyconseil

It was removed but it's back because of https://github.com/getsentry/sentry-react-native/pull/2015 We can remove it again for the 5.x release since we don't need to support older RN versions in that major bump.

marandaneto avatar Aug 03 '22 17:08 marandaneto

Hi @marandaneto , it's great, do you have an ETA for the 5.x release ? Meanwhile I presume we must switch to lodash the whole instead of picking everything.

kopax-polyconseil avatar Aug 03 '22 21:08 kopax-polyconseil

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 label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


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

github-actions[bot] avatar Sep 08 '22 00:09 github-actions[bot]

Keep open

kopax-polyconseil avatar Sep 08 '22 05:09 kopax-polyconseil

https://github.com/getsentry/sentry-react-native/blob/e96259b6ed55622619015e580ed9ca98f29ef8d5/package.json#L57

On the next major version v5, the wizard was moved to the dev deps, so please upgrade your SDK when you feel comfortable with, since its not GA yet.

marandaneto avatar Sep 27 '22 09:09 marandaneto