首先打开package.json
,再scripts属性下添加以下命令:
"scripts": {
...
"lib:build": "vue-cli-service build --target lib --name VuePartivleground ./src/components/VuePartivleground/index.js",
"lib:publish": "npm run lib:build && npm publish"
},
VuePartivleground
在为组件名称,./src/components/VuePartivleground/index.js
为组件入口文件位置
执行npm run lib:build
后,会生成dist目录,组件生成的包就在这个目录下面。