zoukankan      html  css  js  c++  java
  • dependencies 和 devDependencies

    npm install node_module –save自动更新dependencies字段值

    npm install node_module –save-dev自动更新devDependencies字段值

    看下面的一个package.json文件

    {
      "private": true,
      "version": "0.0.1",
      "description": "YOUR DESCRIPTION - Generated by generator-react-webpack",
      "main": "",
      "scripts": {
        "clean": "rimraf dist/*",
        "copy": "copyfiles -f ./src/index.html ./src/favicon.ico ./dist",
        "dist": "npm run copy & webpack --env=dist",
      },
      "repository": "",
      "keywords": [],
      "author": "Your name here",
      "devDependencies": {
        "babel-core": "^6.0.0",
        "babel-eslint": "^6.0.0",
        "babel-loader": "^6.0.0",
        "babel-polyfill": "^6.3.14",
        "babel-preset-es2015": "^6.0.15",
        "babel-preset-react": "^6.0.15",
        "babel-preset-stage-0": "^6.5.0",
        "bower-webpack-plugin": "^0.1.9",
        "chai": "^3.2.0",
        "copyfiles": "^1.0.0",
        "css-loader": "^0.23.0",
        "eslint": "^3.0.0",
        "eslint-loader": "^1.0.0",
        "eslint-plugin-react": "^6.0.0",
        "file-loader": "^0.9.0",
        "mocha": "^3.0.0",
        "null-loader": "^0.1.1",
        "open": "0.0.5",
        "phantomjs-prebuilt": "^2.0.0",
        "react-addons-test-utils": "^15.0.0",
        "react-hot-loader": "^1.2.9",
        "rimraf": "^2.4.3",
        "style-loader": "^0.13.0",
        "url-loader": "^0.5.6",
        "webpack": "^1.12.0",
        "webpack-dev-server": "^1.12.0"
      },
      "dependencies": {
        "core-js": "^2.0.0",
        "normalize.css": "^4.0.0",
        "react": "^15.0.0",
        "react-dom": "^15.0.0"
      }
    }
    

    相信你已经找到了区别:

    devDependencies只用于开发阶段完成集成测试等功能模块依赖;(例如eslint,webpack的loader)

    dependencies  实际生产环境所需要模块依赖;(例如:react框架的核心文件)

    文章为原创,转载请注明出处,谢谢

  • 相关阅读:
    POJ 1018 Communication System
    POJ 1017 Packets
    Codeforces 725B Food on the Plane
    Lessons learned from manually classifying CIFAR-10
    CCF推荐国际学术期刊
    局部数组过大导致编译栈区溢出问题
    自己动手写处理器之第一阶段(3)——MIPS32指令集架构简单介绍
    C++学习笔记29,引用变量(1)
    Android视频应用去广告学习实践
    sublime编辑器怎样高速输入PHP头部版本号声明
  • 原文地址:https://www.cnblogs.com/gagag/p/6075414.html
Copyright © 2011-2022 走看看