zoukankan      html  css  js  c++  java
  • npm install --save/--save-dev的区别

    官方文档只是简单的说:

    --save: Package will appear in your dependencies. 

    --save-dev: Package will appear in your devDependencies.

    真正的区别是:

    --save-dev:

    dev指的是development:This is useful when installing development-only packages, like grunt, gulp or your testing library. Thus, when you are distributing your code to production, these dependencies will not be available.

    这就是说,devDependencies下列出的模块,是我们开发时用的,比如grunt-contrib-uglify, 我们用它来混淆js文件,它们不会被部署到生成环境。有一个方法可以很好的检验这一点,将node_modules删掉,然后npm install --production会发现,只会安装到dependencies。

    以及其他方便我们开发的工具,比如angular, vue, sass等都只需要安装到devDependencies。

    --save:

    You will use this option when you want to save a package dependency for distribution. Item such as angularjs, or any other module that is required at run time by your program.

    dependencies下的模块,是我们生产环境中需要的依赖。

     

    参考链接http://imcodebased.com/npm-save-or-save-dev-which-one-to-use/

  • 相关阅读:
    Get IPv4 Address 2.0
    Apache Tomcat Manager 2.0
    Apache Tomcat Manager 1.0
    FTP自动登录脚本文件
    VMware Workstation 10 + CentOS-5.5-i386 + MySQL Server 5.5
    Copy Files Blurry 1.0
    Extract Chorus From Audio 1.0
    Refresh Baidu Zhidao Evaluate Num 2.0
    File Split 1.0
    其它有趣的事情分享
  • 原文地址:https://www.cnblogs.com/guojunru/p/6092644.html
Copyright © 2011-2022 走看看