# vue-component-demo **Repository Path**: dahaizhenqiang/vue-component-demo ## Basic Information - **Project Name**: vue-component-demo - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-11-23 - **Last Updated**: 2023-11-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # vue-component-demo npm打包lib ## 增加lib命令进入package.json文件 在script中加上一句话, “lib”: “vue-cli-service build –target lib –name cuclife –dest lib packages/custome/index.js” “scripts”: { “serve”: “vue-cli-service serve”, “build”: “vue-cli-service build”, “lint”: “vue-cli-service lint”, “lib”: “vue-cli-service build --target lib --name young-form --dest lib packages/custome/index.js” } 主要需要四个参数: target: 默认为构建应用,改为 lib 即可启用构建库模式 name: 输出文件名 dest: 输出目录,默认为dist,这里我们改为 lib entry: 入口文件路径,默认为 src/App.vue,这里改为 packages/custome/index.js ## npm run lib 编译组件 ## Project setup ``` npm install ``` ### Compiles and hot-reloads for development ``` npm run serve ``` ### Compiles and minifies for production ``` npm run build ``` ### Lints and fixes files ``` npm run lint ``` ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/).