-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
65 lines (63 loc) · 1.56 KB
/
vite.config.js
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
/*
* @Description:
* @Author: 欧阳承珺
* @LastEditors: 欧阳承珺
* @Date: 2024-10-25 10:38:30
* @LastEditTime: 2024-10-28 11:38:15
*/
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import postCssPxToRem from 'postcss-pxtorem'
import UnoCSS from 'unocss/vite'
import { presetUno, presetAttributify, presetIcons } from 'unocss'
// element 按需导入
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
AutoImport({
resolvers: [ElementPlusResolver()],
imports: ['vue'], // vue自动导入
eslintrc: {
enabled: true,
filepath: './.eslintrc-auto-import.json',
globalsPropValue: 'readonly'
}
}),
Components({
resolvers: [ElementPlusResolver()]
}),
UnoCSS({
presets: [presetUno(), presetAttributify(), presetIcons()]
})
],
css: {
postcss: {
plugins: [
postCssPxToRem({
rootValue: 100,
propList: ['*']
}),
{
postcssPlugin: 'internal:charset-removal',
AtRule: {
charset: (atRule) => {
if (atRule.name === 'charset') {
atRule.remove()
}
}
}
}
]
}
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})