Skip to content

Review Lodash dependency  #18

Open
@cjke

Description

@cjke

Hello, cool library!

Would it be possible to review the approach to importing lodash? I've seen the PR that recommended the es approach, and agree that was not the way to go.

I think there are two simple solutions:

Option 1. Import with a slash as recommended at the end of the official docs: https://lodash.com/per-method-packages
For example, in astar-finder.ts:

import { minBy, remove } from 'lodash';

Becomes

import minBy from 'lodash/minBy';
import remove from 'lodash/remove';

This should dramatically cut down the bundle size.

Option 2. Alternatively, perhaps set lodash as a peer dependency?
At the moment, if I too use lodash, I end up with a double sized bundle, which would be removed when set as a peer.
(but I still prefer option 2, or maybe even both)

Example of a project using lodash + astar-typescript using lodash 😱
image

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions