ea-remote-component
v1.0.0
Published
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Downloads
19
Readme
Vue 3 + Vite
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.
Learn more about IDE Support for Vue in the Vue Docs Scaling up Guide.
打包为 npm 包(Vite library mode)
项目已配置 Vite 的 library 模式,可将 src 下的组件打包到 dist/components:
构建命令:
npm run build:lib构建后会在 dist/components 下生成 index.js(CJS)、index.es.js(ESM)和 index.umd.js(UMD),package.json 中 main、module 和 exports 已指向 dist/components/index.js,你可以根据需要在发布前调整这些字段。
发布到 npm 的基本步骤:
- 更新
version、name(非 private)和其他元数据。 - 登录 npm:
npm login。 - 运行
npm run build:lib。 - 运行
npm publish --access public。
注意:构建时 vue 被标记为外部依赖(peer dependency),请在 package.json 中将其加入 peerDependencies。例如:
"peerDependencies": {
"vue": "^3.2.0"
}