refactor: optimize tree-shaking for lodash to reduce bundle size #1350

Closed
opened 2026-04-05 16:27:02 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @soknaly on 12/5/2023

Optimize tree-shaking for lodash to reduce bundle size

As Dictionary type is not necessarily needed from lodash and there's an existing type for that in Common. So we can use that instead.

Note that to achieve this we need to stop using import _ from 'lodash';

We saved 300kb for gzip compression.

Pull Request Checklist:

  • Please make sure all jobs pass before requesting a review.
  • Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).
  • Have you lint your code locally before submission?
  • Did you write tests where appropriate?

Screenshots (if appropriate):

Before:

Screenshot 2023-12-05 at 7 37 00 in the evening

After:

Screenshot 2023-12-05 at 7 38 58 in the evening
*Originally created by @soknaly on 12/5/2023* ### Optimize tree-shaking for lodash to reduce bundle size As Dictionary type is not necessarily needed from lodash and there's an existing type for that in Common. So we can use that instead. Note that to achieve this we need to stop using `import _ from 'lodash';` We saved 300kb for gzip compression. ### Pull Request Checklist: - [ ] Please make sure all jobs pass before requesting a review. - [ ] Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such). - [x] Have you lint your code locally before submission? - [ ] Did you write tests where appropriate? ### Related Issue? ### Screenshots (if appropriate): #### Before: ![Screenshot 2023-12-05 at 7 37 00 in the evening](https://github.com/OneUptime/oneuptime/assets/20983608/a954892d-9e3d-4a39-a24e-8b235d7f3f99) #### After: <img width="1230" alt="Screenshot 2023-12-05 at 7 38 58 in the evening" src="https://github.com/OneUptime/oneuptime/assets/20983608/11b0304d-ba19-4e55-b6b5-d0df2b15b90d">
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/oneuptime#1350