-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
110 lines (98 loc) · 3.49 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ArcoResolver } from 'unplugin-vue-components/resolvers'
import VueRouter from 'unplugin-vue-router/vite'
import { VueRouterAutoImports } from 'unplugin-vue-router'
import VueDevTools from 'vite-plugin-vue-devtools'
// @ts-ignore
import Layouts from 'vite-plugin-vue-layouts'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
VueDevTools(),
VueRouter({
// Folder(s) to scan for vue components and generate routes. Can be a string, or
// an object, or an array of those. Each option allows to override global options.
// like exclude, extensions, etc.
routesFolder: 'src/pages',
// allowed extensions for components to be considered as pages
// can also be a suffix: e.g. `.page.vue` will match `home.page.vue`
// but remove it from the route path
extensions: ['.vue'],
// list of glob files to exclude from the routes generation
// e.g. ['**/__*'] will exclude all files and folders starting with `__`
// e.g. ['**/__*/**/*'] will exclude all files within folders starting with `__`
// e.g. ['**/*.component.vue'] will exclude components ending with `.component.vue`
exclude: ['**/__*', '**/components/**/*'],
// Path for the generated types. Defaults to `./typed-router.d.ts` if typescript
// is installed. Can be disabled by passing `false`.
dts: 'types/typed-router.d.ts',
// Override the name generation of routes. unplugin-vue-router exports two versions:
// `getFileBasedRouteName()` (the default) and `getPascalCaseRouteName()`. Import any
// of them within your `vite.config.ts` file.
// getRouteName: (routeNode) => myOwnGenerateRouteName(routeNode),
// Customizes the default langage for `<route>` blocks
// json5 is just a more permissive version of json
routeBlockLang: 'json5',
// Change the import mode of page components. Can be 'async', 'sync', or a function with the following signature:
// (filepath: string) => 'async' | 'sync'
importMode: 'async'
}),
// ⚠️ Vue must be placed after VueRouter()
vue(),
Layouts({
layoutsDir: 'src/layouts'
}),
vueJsx(),
AutoImport({
resolvers: [
ArcoResolver({
sideEffect: false
})
],
dts: 'types/auto-imports.d.ts',
imports: [
// Vue
'vue',
VueRouterAutoImports,
{
// add any other imports you were relying on
'vue-router/auto': ['useLink']
}
],
eslintrc: {
enabled: true,
filepath: './.eslintrc-auto-import.json'
}
}),
Components({
dts: 'types/components.d.ts', // default is true
globs: ['**/components/*.{vue}'],
resolvers: [
ArcoResolver({
sideEffect: false
}),
(componentName) => {
// if (componentName.includes('Query')) {
// console.log(1, componentName)
// }
if (componentName === 'QueryHeader') {
return {
name: 'AQueryHeader',
from: '@dangojs/a-query-header'
}
}
}
]
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})