npm install 插件 --save与 --save -dev的区别

npm i 插件   ,会把插件安装到node_modules目录中,不会修改package.json,

npm i 插件 --save  ,项目发布上线之后还会依赖用到的插件,没有这些插件,项目不能运行

自动更改package.json  

"dependencies": {
  "axios": "^0.16.1",
  "vue": "^2.2.6",
  "vue-infinite-scroll": "^2.0.1",
  "vue-lazyload": "^1.0.5",
  "vue-resource": "^1.3.1",
  "vue-router": "^2.3.1",
  "vuex": "^2.3.1"
},
npm i 插件 --save-dev ,安装到开发依赖中,项目上线之后不会用到的插件,例如'babel-loader',项目解析完发布
自动更改package.json  
"devDependencies": {
  "autoprefixer": "^6.7.2",
  "babel-cli": "^6.24.1",
  "babel-core": "^6.22.1",
  "babel-loader": "^6.2.10",
  "babel-plugin-transform-runtime": "^6.22.0",
  "babel-preset-env": "^1.3.2",
  "babel-preset-stage-2": "^6.22.0",
  "babel-register": "^6.22.0",
  "url-loader": "^0.5.8",
  "vue-loader": "^11.3.4",
  "vue-style-loader": "^2.0.5",
  "vue-template-compiler": "^2.2.6",
  "webpack": "^2.3.3",
  "webpack-bundle-analyzer": "^2.2.1",
  "webpack-dev-middleware": "^1.10.0",
  "webpack-hot-middleware": "^2.18.0",
  "webpack-merge": "^4.1.0"
},

 

转载于:https://www.cnblogs.com/rakich/p/11076828.html

你可能感兴趣的:(npm install 插件 --save与 --save -dev的区别)