Skip to content

request: Replace lodash with a smaller alternative #445

@beeequeue

Description

@beeequeue

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

This package uses a few utilities from lodash and lists it in the dependencies.
This means all users of the library will have to download the entire lodash library, which can be improved!

Desired solution

I would recommend bundling the library by moving it to the devDeps, this would allow tsup to treeshake the ununsed code and make sure only used functions are included in the published library.

You can also replace lodash entirely by using smaller alternatives to the two functions you use (get and uniqWith). I would still recommend bundling whatever you use, since the utility functions in question are very small and usually turns out less than 1kb in size after bundling them 😄

The easiest replacement is es-toolkit which implements compatible functions compatible with lodash, but faster and smaller.

Alternatives considered

There's also dlv for get, but it only supports foo.0.bar syntax and not foo[0].bar like in your documentation

And uniqWith is a fairly simple function that could be manually written for the project

Additional context

I can open a PR for this if you're up for it!


There's also some other changes I am open to help with if you want:

  • tsup is no longer actively maintained in favor of tsdown
  • rimraf is generally not necessary anymore, either letting bundlers clean dirs by themselves or using premove instead
  • fast-deep-equal could be replaced with dequal as it's ever so slightly faster and better, but the differences are not very large.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions