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框架的核心文件)

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

  • 相关阅读:
    iOS企业账号打包发布App到自己服务器上
    DBus 接口
    Ubuntu下安装gazebo
    Ubuntu下添加开机启动脚本
    Ubuntu录屏软件Kazam
    使用ceres编译报错 error: ‘integer_sequence’ is not a member of ‘std‘
    LINUX中查看、添加、删除PATH以及永久添加PATH
    Ubuntu完美解决Github网站打不开问题
    PointNet原理详解
    目标检测算法RCNN,Fast RCNN,Faster RCNN
  • 原文地址:https://www.cnblogs.com/gagag/p/6075414.html
Copyright © 2011-2022 走看看