amazon-web-services - 是否有工具可以从 node_modules 中删除不需要的文件,甚至从使用过的包中删除?
问题描述
这里的用例是 AWS lambda。如今,npm 模块包含所有文档、测试、示例、网站等。所以当我们上传 zip 文件时,它包含了所有不需要的文件。
解决方案
这是另一个做同样工作的模块,值得一试https://github.com/tj/node-prune。
(来自自述文件)
安装
从来源:
$ go get github.com/tj/node-prune/cmd/node-prune
从二进制到./bin/node-prune
:
$ curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash
从二进制到/usr/local/bin/node-prune
:
$ curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin
用法
在您的应用程序目录中:
$ node-prune
files total 27,330
files removed 3,990
size removed 13 MB
duration 200ms
别的地方:
$ node-prune path/to/node_modules
files total 27,330
files removed 3,990
size removed 13 MB
duration 200ms
推荐阅读
- java - 运动队模型 - 类中的构造函数不能应用于给定类型
- python - 如何在 python 中并行化以下代码片段?
- arrays - 将数组元素连接到新数组中
- go - 如何使用 gopacket 为 32 位 mips 编译 Go 应用程序
- apache-superset - 将数据连接到超集
- amazon-web-services - 我可以使用 AWS-UpdateLinuxAmi AWS SSM 文档基于最新的 amazon linux 2 构建 AMI 吗?
- reactjs - React.js 路由器参数作为属性值
- ruby - Ruby 在 Ferrum 中设置自定义用户代理
- javascript - 如何根据 url 中的对象属性和路径动态呈现内容
- javascript - 登录导航问题后反应导航