-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
53 lines (47 loc) · 1.48 KB
/
Copy pathvite.config.ts
File metadata and controls
53 lines (47 loc) · 1.48 KB
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
import path from 'node:path'
import process from 'node:process'
import { defineConfig, loadEnv } from 'vite'
import Vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import { visualizer } from 'rollup-plugin-visualizer'
import UnoCSS from 'unocss/vite'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
// Load env file based on `mode` in the current working directory.
// Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
const env = loadEnv(mode, process.cwd(), '')
return {
base: env.VITE_BASE,
define: {
// disable Options API support
__VUE_OPTIONS_API__: false,
},
// 别名设置
resolve: {
alias: {
'@/': `${path.resolve(__dirname, 'src')}/`,
},
},
plugins: [
Vue(),
// https://github.com/antfu/unplugin-auto-import
AutoImport({
imports: ['vue', 'vue-router', 'pinia', '@vueuse/core'],
dts: 'src/auto-import.d.ts',
dirs: ['src/composables', 'src/stores'],
vueTemplate: false,
}),
// https://github.com/antfu/unplugin-vue-components
Components({
dts: 'src/components.d.ts',
resolvers: [NaiveUiResolver()],
}),
visualizer(),
// https://github.com/antfu/unocss
// see uno.config.ts for config
UnoCSS(),
],
}
})