-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
67 lines (65 loc) · 1.75 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
import { resolve } from "path";
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import WindiCSS from "vite-plugin-windicss";
import Pages from "vite-plugin-pages";
import Layouts from "vite-plugin-vue-layouts";
import ViteComponents from "vite-plugin-components";
import ViteIcons, { ViteIconsResolver } from "vite-plugin-icons";
import { viteThemePlugin, antdDarkThemePlugin } from 'vite-plugin-theme';
import { getLessVars } from 'antd-theme-generator';
// antd自定义变量和暗黑模式变量
import antdCustomVars from './src/antd/custom'
const antdDarkVars = getLessVars('./node_modules/ant-design-vue/lib/style/themes/dark.less')
// https://vitejs.dev/config/
export default defineConfig({
resolve:{
alias: {
'~/': `${resolve(__dirname, 'src')}/`,
}
},
// https://github.com/vueComponent/ant-design-vue/issues/4220
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
modifyVars: {
'primary-color': '#7546c9'
}
},
},
},
plugins: [
vue(),
WindiCSS(),
Pages(),
Layouts(),
ViteComponents({
// auto import icons
customComponentResolvers: [
// https://github.com/antfu/vite-plugin-icons
ViteIconsResolver({
componentPrefix: "",
}),
(name: string) => {
if (name.startsWith('A'))
return { importName: name.slice(1), path: 'ant-design-vue' }
},
],
}),
// https://github.com/antfu/vite-plugin-icons
ViteIcons(),
viteThemePlugin({
colorVariables: ['#7546c9'],
}),
antdDarkThemePlugin({
darkModifyVars: {
'primary-color': '#7546c9',
...antdDarkVars
}
})
],
server: {
host: '0.0.0.0',
}
})