ai / nanoid

A tiny (124 bytes), secure, URL-friendly, unique string ID generator for JavaScript
https://zelark.github.io/nano-id-cc/
MIT License
24.62k stars 790 forks source link

52.4 kb in `node_modules` #308

Closed igorkamyshev closed 3 years ago

igorkamyshev commented 3 years ago

I've applied https://github.com/antonk52/why-npm-i-so-long to my project and found that nanoid took 52.4 kb in node_modules. Is it expected amount of space?

Screenshot 2021-10-07 at 17 32 08
ai commented 3 years ago

Yeap, because of dual CJS/ESM support, we duplicate every file. We need it for tree-shaking.

And also we have many comments. In the latest 3.1.29 we made this package size 2 times smaller by removing comments on release.

Maybe in 4.x we will split non-secure and async versions to different versions.

ai commented 3 years ago

Also you can review node_modules/nanoid content. Feel free to open issue on any unnecessary file there.

igorkamyshev commented 3 years ago

Thanks for explanation. I've checked content of node_modules/nanoid, but decided to ask because it wasn't clear for me.