You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 😱
The text was updated successfully, but these errors were encountered:
Thank you for your input. It might be that I am going to rewrite the core of the library and maybe not use lodash.js anymore. I am not sure though, when this is going to happen.
Option 1 sounds reasonable.
I have never used peerDependencies, but I believe that this will not work. If I add lodash.js as a peerDependencies I will not be able to access it from my library. See this article:
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
:Becomes
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 😱

The text was updated successfully, but these errors were encountered: