-
Notifications
You must be signed in to change notification settings - Fork 9
/
vite.config.ts
82 lines (80 loc) · 2.16 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import VueRouter from 'unplugin-vue-router/vite'
import Layouts from 'vite-plugin-vue-meta-layouts'
import { VueRouterAutoImports } from 'unplugin-vue-router'
import regexpPlugin from 'rollup-plugin-regexp'
import * as mdicons from '@mdi/js'
const mdi: Record<string, string> = {}
Object.keys(mdicons).forEach((key) => {
const value = (mdicons as Record<string, string>)[key]
mdi[
key
.replace(/([A-Z])/g, '-$1')
.toLowerCase()
.replace(/([0-9]+)/g, '-$1')
] = value
})
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
regexpPlugin({
exclude: ['node_modules/**'],
find: /\b(?<![/\w])(mdi-[\w-]+)\b(?!\.)/,
replace: (match: string) => {
if (mdi[match]) {
return mdi[match]
} else {
console.warn('[plugin-regexp] No matched svg icon for ' + match)
return match
}
},
sourcemap: false,
}),
VueRouter({ importMode: 'sync', dts: './src/typed-router.d.ts' }),
Vue({
template: { transformAssetUrls },
features: { propsDestructure: true },
}),
Layouts(),
Vuetify({ autoImport: true }),
Components({ dts: './src/components.d.ts', types: [] }),
AutoImport({
imports: [
'vue',
'pinia',
VueRouterAutoImports,
{
vuetify: [
'useTheme',
'useRtl',
'useLocale',
'useDisplay',
'useLayout',
],
},
],
dts: 'src/auto-imports.d.ts',
dirs: ['src/stores'],
}),
],
css: {
devSourcemap: true,
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
test: {
globals: true,
include: ['test/**/*.{test,spec}.ts', 'src/**/__tests__/*'],
environment: 'jsdom',
setupFiles: ['./test/setup.ts'],
server: { deps: { inline: ['vuetify'] } },
},
})