如何查看 npm 包的大小? [英] How do I view the size of npm packages?

查看:118
本文介绍了如何查看 npm 包的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 NPM 上搜索包时,我想查看包大小(以 KB 或 MB 为单位等).NPM 似乎没有显示此信息.

When I search for packages on NPM, I would like to see package sizes (in KB or MB, etc). NPM doesn’t seem to show this information.

如何确定一个 NPM 包会给我的项目增加多少膨胀?

How can I determine how much bloat an NPM package will add to my project?

推荐答案

您可能想要衡量的是,如果您要将包添加到应用程序包中所产生的影响.大多数其他答案将仅估计源文件的大小,由于内联注释、长变量名称等原因,这可能不准确.

What you probably want to measure is the impact a package has if you were to add it to your app bundle. Most of the other answers will estimate the size of the source files only, which maybe inaccurate due to inline comments, long var names etc.

我制作了一个小实用程序,它会告诉你包进入你的捆绑包之后的最小 + gzipped 大小 -

There is a small utility I made that'll tell you the min + gzipped size of the package after it gets into you bundle -

https://bundlephobia.com

这篇关于如何查看 npm 包的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆