WebPack npm --save-dev --save | -D -S区别

-S:--save的简写,等同于npm run start 只需输入npm start,这两个效果是一样的。
-D:--save-dev的简写,其包名称及版本号会存在package.json的devDependencies这个里面,而--save则会将包名称及版本号放在dependencies里面。

延伸:dependencies是运行时依赖,devDependencies是开发时的依赖

{
  "name": "StudyWebpack",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "webpack --mode development",
    "build": "webpack --mode production"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "jquery": "^3.3.1"
  },
  "devDependencies": {
    "webpack": "^4.16.1",
    "webpack-cli": "^3.1.0",
    "webpack-command": "^0.4.1"
  }
}

 

你可能感兴趣的:(Webpack,--save-dev,--save,-D,-S区别,webpack)