-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.ts
45 lines (40 loc) · 1.24 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
import path from 'path';
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import Pages from 'vite-plugin-pages';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { ViteWebfontDownload } from 'vite-plugin-webfont-dl';
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
const envMode = command === 'serve' ? mode : process.env.NODE_ENV || mode || 'production';
process.env = { ...process.env, ...loadEnv(envMode.trim().toLowerCase(), process.cwd()) };
return {
plugins: [
vue(),
Pages(),
AutoImport({
imports: [
'vue',
'vue-router',
'@vueuse/head',
'@vueuse/core',
{ 'vue3-toastify': ['toast'] },
],
dirs: ['./src/lib/**', './src/composables'],
dts: 'src/auto-imports.d.ts',
}),
Components({
dts: 'src/components.d.ts',
}),
ViteWebfontDownload([
'https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@700&family=IBM+Plex+Sans:wght@400;700&display=swap',
]),
],
resolve: {
alias: {
'~': `${path.resolve(__dirname, 'src')}/`,
},
},
};
});