-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.js
66 lines (64 loc) · 1.9 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
66
/// <reference types="vitest" />
import { fileURLToPath, URL } from 'node:url'
import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import VueDevTools from 'vite-plugin-vue-devtools'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { VantResolver } from 'unplugin-vue-components/resolvers'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
// https://vitejs.dev/config/
export default defineConfig(({ command }) => (
{
plugins: [
vue(),
vueJsx(),
VueDevTools(),
AutoImport({
dts: true,
imports: [
'vue', 'vue-router', 'pinia', 'vitest',
{
'@vue/test-utils': ['mount', 'shallowMount'],
},
],
eslintrc: {
enabled: true,
filepath: './.eslintrc-auto-import.json',
},
}),
Components({
dts: true,
resolvers: [VantResolver()],
dirs: ['src/components'],
}),
// https://github.com/vbenjs/vite-plugin-svg-icons/blob/main/README.md
createSvgIconsPlugin({
iconDirs: [path.resolve(process.cwd(), 'src/icons')],
symbolId: 'icon-[dir]-[name]',
customDomId: '__svg__icons__dom__',
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
_a: fileURLToPath(new URL('./src/api', import.meta.url)),
_c: fileURLToPath(new URL('./src/components', import.meta.url)),
_i: fileURLToPath(new URL('./src/assets/images', import.meta.url)),
_u: fileURLToPath(new URL('./src/utils', import.meta.url)),
},
},
base: './',
server: {
open: true,
},
esbuild: {
drop: command === 'build' ? ['console', 'debugger'] : [],
},
test: {
environment: 'jsdom',
},
}
))