CouncilDataProject / CouncilDataProject/cdp-frontend
Consider removing `lodash` and `moment` packages
- Dominant language
- TypeScript
- Stars
- 17
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
### Feature Description
While reviewing another PR, I just noticed we're using `lodash`, which prompted me to do a check-up on our package weight and discovered that we're sitting at a [pretty hefty 2MB](https://bundlephobia.com/package/@councildataproject/cdp-frontend@0.4.3) _after_ minification.
Of those 2MB, nearly 20% of that is caused by `lodash` and `moment`.
If you do a search for where these two packages are being used you'll find that:
Two functions from `lodash` are used in [one file](https://github.com/CouncilDataProject/cdp-frontend/blob/main/src/networking/EventSearchService.ts#L9) (although there will soon be a third function added to a [second file](https://github.com/CouncilDataProject/cdp-frontend/blob/5b902242a50af128bfca9528072bddb19b0b0ceb/src/components/Filters/FilterPopup/FilterPopup.tsx#L11) when [this PR](https://github.com/CouncilDataProject/cdp-frontend/pull/110) gets merged).
One function from `moment` is also used in [a file](https://github.com/CouncilDataProject/cdp-frontend/blob/main/src/components/Filters/SelectDateRange/getDateText.ts#L1). _Also as a side note, `moment` is currently installed as both a [dependency](https://github.com/CouncilDataProject/cdp-frontend/blob/main/package.json#L126) and [dev dependency](https://github.com/CouncilDataProject/cdp-frontend/blob/main/package.json#L94) 🤔._
In both of these cases, the functions we use from these libraries can be replaced with lighter alternative packages or even our own implementations of these utilities.
TLDR: I don't think 4 utility functions are worth a 20% increase in package weight.
### Use Case
Package weight (and by proxy website weight) are an absolutely crucial metric for making sure the CDP website loads quickly.
### Solution
As mentioned earlier we should remove `lodash` and `moment` and replace the 4 utility functions with a lighter utility package or our own custom implementation of the util functions.
Contributor guide
Assessment
This issue has not been assessed yet.