-
Notifications
You must be signed in to change notification settings - Fork 53
/
vite.config.ts
61 lines (59 loc) · 1.47 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
import { fileURLToPath } from 'url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Icons from 'unplugin-icons/vite'
import IconResolver from 'unplugin-icons/resolver'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
const PROD = process.env.NODE_ENV === 'production'
export default defineConfig({
plugins: [
vue(),
AutoImport({
dts: true,
imports: [
'vue',
'vue-router',
'vue-i18n',
'@vueuse/core',
{ axios: [['default', 'axios']] },
],
resolvers: [
IconResolver({
alias: {
fas: 'fa-solid',
},
}),
],
dirs: ['src/components/**', 'src/composables', 'src/utils', 'src/types'],
}),
Components({ dts: true, resolvers: [NaiveUiResolver()] }),
Icons({
scale: 1,
defaultClass: 'svg--inline',
}),
],
build: {},
css: {
preprocessorOptions: {
sass: {
/**
* vite 还没有跟进这个,我们先手动设置
* @see https://sass-lang.com/d/legacy-js-api
*/
api: 'modern',
},
},
},
esbuild: {
drop: PROD ? ['console'] : [],
},
server: { host: true },
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', '.json'],
},
})