Norigin-Spatial-Navigation icon indicating copy to clipboard operation
Norigin-Spatial-Navigation copied to clipboard

Replace lodash with native code

Open grobitto opened this issue 1 year ago • 0 comments

I've been using your library for a while and was surprised by the large bundle size after building it. After looking closely, I found that more than 100kb was from lodash functions.

I checked how lodash was used in your code, and most cases were simple. So, I spent a few hours replacing most lodash functions with plain TypeScript, which reduced the bundle size by about 90kb! I kept lodash's debounce and throttle functions since they only add 14kb, which I'm okay with.

I used some relatively modern ES features like Object.entries, which can be polyfilled for older platforms.

Would you be interested in a pull request like this? I'm a bit worried because JS/TS isn't my main language, and it might take time to meet your standards, but I can try my best.

grobitto avatar Oct 18 '24 11:10 grobitto