简体   繁体   English

准备好要分发的node_modules吗?

[英]Prepare node_modules for distribution?

Are there ways to make node_modules more compact for client side usage? 有没有办法使node_modules更加紧凑以供客户端使用? For example with nodewebkit? 例如,使用nodewebkit?

I think about removing unecessary files and minification. 我考虑删除不必要的文件和缩小。

Thanks! 谢谢!

我认为您可以使用npm install --production ,因此您不会为生产环境安装不必要的模块,例如:grunt,gulp,mocha等。当然,这取决于是否使用npm install --save-dev安装开发模块。 npm install --save-dev

Yes, there are ways. 是的,有办法。

Do the following in this order: 按此顺序执行以下操作:

  • npm install --production
  • npm dedupe to flatten the hirarchy and remove duplicates npm dedupe以简化层次结构并删除重复项
  • use grunt package minifier if you have a builder it will remove all the unneccesery files (Readme's, make files, tests, documentation etc.) 如果您有构建器,请使用grunt软件包压缩程序 ,它将删除所有不需要的文件(自述文件,make文件,测试文件,文档等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM