Files
knowai/vite.config.ts
tobegold574 3473009b28 fix(scss, types): 修正打包产物
- 更新SCSS导出方式,支持引用SCSS变量系统(编译为CSS)
- 修复SCSS类名不对应问题
- 修复无types导出问题
- 修改导出路径,避免vite build覆盖其余编译产物
- 支持tree-shaking,不暴露内部路径

BREAKING CHANGES: 1.0.0->2.0.0
2025-11-16 16:32:09 +08:00

35 lines
796 B
TypeScript

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'
export default defineConfig({
// 插件数组
plugins: [vue()],
// 路径别名
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'~': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: {
// 构建为库模式
lib: {
entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
name: 'knowaiUi',
fileName: (format) => `knowai-ui.${format}.js`
},
// 输出目录
outDir: 'dist/client',
emptyOutDir: false,
rollupOptions: {
// 不打包进库
external: ['vue'],
output: {
globals: {
vue: 'Vue'
}
}
}
}
})