-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathvite.config.ts
58 lines (50 loc) · 1.25 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
import autoImport from 'unplugin-auto-import/vite';
import { VueRouterAutoImports } from 'unplugin-vue-router';
import VueRouter from 'unplugin-vue-router/vite';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import transformerDirective from '@unocss/transformer-directives';
import Unocss from 'unocss/vite';
import tsconfigPaths from 'vite-tsconfig-paths';
const basePathForGeneration = './.generated/';
// @ts-expect-error this is a js file.
import { serverPort } from './build/config.js';
const serverConfig = {
host: true,
port: serverPort
};
export default defineConfig({
server: serverConfig,
preview: serverConfig,
plugins: [
tsconfigPaths({}),
VueRouter({
routesFolder: 'src/pages',
extensions: ['.page.vue'],
dts: basePathForGeneration.concat('typed-router.d.ts')
}),
autoImport({
imports: [
'vue',
VueRouterAutoImports,
{
'~/pages/router.ts': ['$router']
}
],
vueTemplate: true,
eslintrc: {
enabled: true,
filepath: basePathForGeneration.concat('eslintrc-auto-import.json')
},
dts: basePathForGeneration.concat('auto-imports.d.ts')
}),
vue({
script: {
propsDestructure: true
}
}),
Unocss({
transformers: [transformerDirective()]
})
]
});