-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
82 lines (81 loc) · 2.05 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* @Author: cola
* @Date: 2023-07-15 16:03:37
* @LastEditors: cola
* @Description:
*/
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import DefineOptions from 'unplugin-vue-define-options/vite'
import Unocss from 'unocss/vite'
import Inspect from 'vite-plugin-inspect'
import VueJsx from '@vitejs/plugin-vue-jsx'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
export default defineConfig({
assetsInclude: ['**/*.JPG'],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
},
build: {
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
},
},
plugins: [
vue(),
VueJsx(),
DefineOptions(),
Components({
dirs: ['src/components', 'main.ts'],
extensions: ['vue'],
deep: true,
dts: true,
resolvers: [
IconsResolver({
alias: {
park: 'icon-park',
},
customCollections: ['custom'],
}),
],
}),
AutoImport({
imports: ['vue', 'vue-router', '@vueuse/core', 'pinia', 'vitest'],
include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/, /\.md$/],
dirs: ['./src/composables'],
eslintrc: {
enabled: true,
globalsPropValue: true,
},
}),
Unocss(),
Icons({
autoInstall: true,
compiler: 'vue3',
customCollections: {
custom: FileSystemIconLoader('./src/icon/svg', (svg) =>
svg
.replace(/(width|height)=['"](\w+)['"]/g, '')
.replace(/^<svg /, '<svg fill="currentColor"'),
),
},
iconCustomizer(collection, icon, props) {
props.width = '1.2em'
props.height = '1.2em'
},
}),
Inspect(),
],
})