npm 的主要功能
- 下载别人编写的第三方包到本地使用
- 下载并安装别人编写的 CLI 到本地使用
- 将自己编写的包或命令行程序发布到 npm上
package.json优化
- 上线精简 devpendenciespeer & Devpendencies
- 把上线依赖的,移动到开发依赖
{
"name": "webpack-demo",
"version": "1.0.0",
"private": true, // 私有仓库
"main": "src/index.js", // 向外暴露的 js入口文件
"scripts": {
"start": "npx webpack",
"build": "echo \"Error: no test specified\" && exit 1",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {},
"devDependencies": {
"cross-env": "^7.0.3",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0"
},
"description": "项目描述",
"keywords": ["项目关键词"],
"author": "",
"license": "MIT"
}