ZAPlayer/vite.lib.config.js
2026-01-30 11:24:39 +08:00

31 lines
856 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from 'vite'
import { resolve } from 'path'
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, 'src/main.js'),
name: 'ZAPlayer',
fileName: (format) => {
// 根据格式生成不同的文件名
if (format === 'es') {
return 'za-player.es.js' // ES模块格式
} else if (format === 'umd') {
return 'za-player.min.js' // UMD压缩格式
}
return `za-player.${format}.js`
},
formats: ['es', 'umd'] // 同时生成ES和UMD格式
},
rollupOptions: {
external: [],
output: {
globals: {}
}
},
// 使用Vite内置的压缩esbuild不需要额外依赖
minify: 'esbuild', // 或者使用 trueVite默认压缩
// 不生成source map
sourcemap: false
}
})