-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.ts
60 lines (59 loc) · 1.36 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import { resolve } from 'path'
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import { presetUno, presetAttributify, presetIcons } from 'unocss';
import Unocss from './config/unocss';
import Components from 'unplugin-vue-components/vite'; // 更新这里
export default defineConfig({
resolve: {
dedupe: ['vue']
},
build: {
cssCodeSplit: true,
lib: {
entry: resolve(__dirname, './packages/entry.ts'),
name: 'CatIsolUI',
fileName: (format) => `catisol-ui.${format}.js`, // 根据格式设置打包后的文件名
formats: ['esm', 'umd', 'iife']
},
rollupOptions: {
external: ['vue'],
output: {
assetFileNames: 'assets/[name][extname]',
globals: {
vue: 'Vue'
}
}
},
},
test: {
global: true,
transformMode: {
tsx: 'jsx'
},
coverage: {
reporter: ['text', 'json', 'html']
},
environment: 'happy-dom'
},
server: {
hmr: {
overlay: false
}
},
plugins: [
// 添加UnoCSS和JSX插件
Unocss({
presets: [presetUno(), presetAttributify(), presetIcons()]
}),
vueJsx(),
vue(),
Components({
dirs: ['packages/*'],
extensions: ['vue'],
deep: true, // 如果组件分布在子目录的多个层级中,确保设置为true
}),
]
});