1.npm初始化 设置相关信息
npm init
2.设置npm 镜像
npm config set registry https://registry.npmjs.org/
3.查看镜像
npm get registry
4.登录
npm login
5.发布
npm publish
6.package.json重要参数解析
{ "name": "",//包的名称 "version": "",//版本 注意每次版本不能相同 "description": "",//描述 "main": "lib/gw-map-l.umd.min.js", //重要 包的主要位置 也可以打包后发布 dist/vue3ol.common.js "keyword": "",//关键字 "private": false,//是否私有 "license": "MIT",//重要 "author": "zhupan", "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint", "lib": "vue-cli-service build --target lib --name gw-map-l --dest lib packages/index.js"//重要 --name包名 --dest lib 入口文件 }, "dependencies": { }, "devDependencies": { }, "eslintConfig": { "root": true, "env": { "node": true }, "extends": [ "plugin:vue/essential", "eslint:recommended" ], "parserOptions": { "parser": "babel-eslint" }, "rules": {} }, "browserslist": [ "> 1%", "last 2 versions", "not dead" ] }