Open cjke opened 3 years ago
Hello @cjke
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:
https://classic.yarnpkg.com/blog/2018/04/18/dependencies-done-right
--> The peerDependencies object guarantees that, for each entry, any
package that requires you (...)
Keep you updated.
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 😱![image](https://user-images.githubusercontent.com/884065/100736911-87b3ab80-3427-11eb-89fd-c565ad27e56c.png)