-
Notifications
You must be signed in to change notification settings - Fork 486
/
vite.config.base.ts
50 lines (49 loc) · 1.27 KB
/
vite.config.base.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
import { resolve } from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import autoprefixer from 'autoprefixer'
import Icons from 'unplugin-icons/vite'
import AutoImport from 'unplugin-auto-import/vite'
import IconsResolver from 'unplugin-icons/resolver'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
export default defineConfig({
plugins: [
vue(),
vueJsx(),
AutoImport({
// 包括的文件类型
include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/, /\.md$/],
resolvers: [ElementPlusResolver(), IconsResolver({ prefix: 'Icon' })],
dts: 'src/auto-imports.d.ts',
}),
Components({
resolvers: [
// 自动注册图标组件
IconsResolver({ enabledCollections: ['ep'] }),
ElementPlusResolver(),
],
dts: 'src/components.d.ts',
}),
Icons({ autoInstall: true }),
],
resolve: {
alias: [
{
find: '@',
replacement: resolve(__dirname, '../src'),
},
],
},
define: {
'process.env': {},
},
css: {
postcss: {
plugins: [
autoprefixer({}), // 自动添加样式兼容前缀
],
},
},
})