--save与--save-dev与-S和-D的区别
--save与--save-dev的区别hello大家周末好,最近写项目的时候因为下载模块的时候用错命令导致线上功能无法进行下去,真的是自己给自己挖坑。大家一起来看下package.json。{"name": "vue-admin-template","version": "3.8.0","license": "MIT","description": "A vue ad...
·
--save与--save-dev的区别
hello大家周末好,最近写项目的时候因为下载模块的时候用错命令导致线上功能无法进行下去,真的是自己给自己挖坑。大家一起来看下package.json。
{
"name": "vue-admin-template",
"version": "3.8.0",
"license": "MIT",
"description": "A vue admin template with Element UI & axios & iconfont & permission control & lint",
"author": "Pan <panfree23@gmail.com>",
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"build": "node build/build.js",
"build:report": "npm_config_report=true npm run build",
"lint": "eslint --ext .js,.vue src",
"test": "npm run lint",
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
},
"dependencies": { //dependencies是生产环境中项目运行的包(项目上线的依赖) 也就是cnpm install xxxx --save
"animate.css": "^3.7.0",
"axios": "0.18.0",
"echarts": "^4.2.1",
"el-cascader-multi": "^1.0.6",
"element-ui": "2.9.1",
"js-cookie": "2.2.0",
"mint-ui": "^2.2.13",
"moment": "^2.24.0",
"muse-ui": "^3.0.2",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"pdfjs-dist": "^2.1.266",
"plupload": "^2.3.6",
"textarea-caret": "^3.1.0",
"v-viewer": "^1.4.2",
"vant": "^1.6.14",
"vconsole": "^3.3.0",
"vue": "2.5.17",
"vue-clipboard2": "^0.3.0",
"vue-router": "3.0.1",
"vue-scroller": "^2.2.4",
"vue-wechat-title": "^2.0.5",
"vuex": "3.0.1"
},
"devDependencies": { //devDependencies这里是开发和测试依赖的包
"autoprefixer": "8.5.0",
"babel-core": "6.26.0",
"babel-eslint": "8.2.6",
"babel-helper-vue-jsx-merge-props": "2.0.3",
"babel-loader": "7.1.5",
"babel-plugin-import": "^1.11.0",
"babel-plugin-syntax-jsx": "6.18.0",
"babel-plugin-transform-runtime": "6.23.0",
"babel-plugin-transform-vue-jsx": "3.7.0",
"babel-preset-env": "1.7.0",
"babel-preset-stage-2": "6.24.1",
"chalk": "2.4.1",
"compression-webpack-plugin": "2.0.0",
"copy-webpack-plugin": "4.5.2",
"css-loader": "1.0.0",
"eslint": "4.19.1",
"eslint-friendly-formatter": "4.0.1",
"eslint-loader": "2.0.0",
"eslint-plugin-vue": "4.7.1",
"eventsource-polyfill": "0.9.6",
"file-loader": "1.1.11",
"friendly-errors-webpack-plugin": "1.7.0",
"html-webpack-plugin": "4.0.0-alpha",
"less": "^3.9.0",
"less-loader": "^4.1.0",
"mini-css-extract-plugin": "0.4.1",
"node-notifier": "5.2.1",
"node-sass": "^4.7.2",
"optimize-css-assets-webpack-plugin": "5.0.0",
"ora": "3.0.0",
"path-to-regexp": "2.4.0",
"portfinder": "1.0.16",
"postcss-import": "12.0.0",
"postcss-loader": "2.1.6",
"postcss-url": "7.3.2",
"rimraf": "2.6.2",
"sass-loader": "7.0.3",
"script-ext-html-webpack-plugin": "2.0.1",
"semver": "5.5.0",
"shelljs": "0.8.2",
"svg-sprite-loader": "3.8.0",
"svgo": "1.0.5",
"uglifyjs-webpack-plugin": "1.2.7",
"url-loader": "1.0.1",
"vue-loader": "15.3.0",
"vue-style-loader": "4.1.2",
"vue-template-compiler": "2.5.17",
"webpack": "4.16.5",
"webpack-bundle-analyzer": "2.13.1",
"webpack-cli": "3.1.0",
"webpack-dev-server": "3.1.14",
"webpack-merge": "4.1.4"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
package.json添加位置
--save-dev 和 -D 添加到 devDependencies
--save 和 -S 添加到 dependencies
总结:
cnpm install xxx --save == cnpm install xxx -S 生产环境的所需依赖也就是咱们的线上环境。
cnpm install xxx --save-dev == cnpm install xxx -D 开发和测试所需的依赖也就是咱们本地环境
更多推荐
已为社区贡献11条内容
所有评论(0)