-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
43 lines (41 loc) · 984 Bytes
/
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
import { loadEnv, defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';
// 自動引入 Icon
import Components from 'unplugin-vue-components/vite';
import Icons from 'unplugin-icons/vite';
import IconsResolver from 'unplugin-icons/resolver';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
// console.log('env value', env);
return {
plugins: [
vue(),
Icons({ compiler: 'vue3' }),
Components({
resolvers: [
IconsResolver({
prefix: false,
enabledCollections: ['ant-design'],
alias: {
ant: 'ant-design',
},
}),
],
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
server: {
proxy: {
'/api': env.VITE_API_URL ? env.VITE_API_URL : '',
},
},
define: {
'process.env': {},
},
};
});