ez-common-ts/vite.config.js

29 lines
795 B
JavaScript
Raw Normal View History

2023-11-10 16:35:59 +08:00
import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default defineConfig({
// 打包配置
build: {
lib: {
entry: 'src/index.ts', // 设置入口文件
name: 'ez-common-ts', // 起个名字,安装、引入用
formats: ['es'],
fileName: (format) => `index.${format}.js` // 打包后的文件名
},
sourcemap: true, // 输出.map文件
rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖
//external: ['vue', 'ant-design-vue'],
/*output: {
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
globals: {
vue: 'Vue',
'ant-design-vue': 'ant-design-vue'
}
} */
},
outDir: 'lib' // 默认为 dist
},
})