缩小并捆绑NodeJS项目 [英] Minify and Bundle NodeJS Project

查看:87
本文介绍了缩小并捆绑NodeJS项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尚未找到有关此主题的太多信息.

Haven't found much information on this topic.

是否有用于缩小和捆绑nodejs服务器项目(包括其node_module依赖项)的工具(gulp)?

Is there any tooling (gulp) for minifying and bundling a nodejs server project including its node_module dependencies?

我有一种情况,我无法在生产计算机上运行npm install,并且我的最大可执行"大小被限制为20 MB.

I have a scenario where I cannot run npm install on the production machine and I am limited to a maximum 20 MB "executable" size.

推荐答案

您应该查看收缩包装实用程序.它基本上允许您冻结依赖项的版本,对节点模块进行GZip压缩,使其易于部署.您可能不需要Gulp,并且压缩包比将其丑化要有效得多.

You should take a look into the shrinkwrap options as well as the shrinkpack utility. It basically allows you to freeze your dependencies' versions, GZips your node modules and makes them easily deployable. You might not need Gulp for that, and Gzipping your packages is a lot more effective than uglifying it.

这篇关于缩小并捆绑NodeJS项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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