npm i 插件 ,會把插件安裝到node_modules目錄中,不會修改package.json,vue
npm i 插件 --save ,項目發佈上線以後還會依賴用到的插件,沒有這些插件,項目不能運行node
自動更改package.json webpack
"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"},