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/

  • 相关阅读:
    maven 常用命令
    navicat 破解
    linux命令
    Git常用命令
    关于近期工作的总结
    ES6新特性学习
    Hadoop初步学习
    串行、并行与并发的理解
    通过Spring profile方式实现多环境部署
    使用MySQL乐观锁解决超卖问题
  • 原文地址:https://www.cnblogs.com/guojunru/p/6092644.html
Copyright © 2011-2022 走看看