forked from nft-rainbow/rainbow-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
58 lines (57 loc) · 1.77 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 { defineConfig, loadEnv } from 'vite';
import path from 'path';
import react from '@vitejs/plugin-react';
import viteCompression from 'vite-plugin-compression';
import Unocss from 'unocss/vite';
import presetIcons from '@unocss/preset-icons';
import presetWind from '@unocss/preset-wind';
import transformerDirective from '@unocss/transformer-directives';
export default ({ mode }) => {
const env = loadEnv(mode, process.cwd());
return defineConfig({
server: {
proxy: {
'^/api/.*': {
target: `${env.VITE_ServiceHost}/`,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
plugins: [
Unocss({
transformers: [transformerDirective()],
presets: [
presetWind(),
presetIcons({
prefix: 'i-',
extraProperties: {
display: 'inline-block',
'vertical-align': 'middle',
},
}),
],
}),
react(),
viteCompression({
threshold: 1024000,
}),
],
resolve: {
alias: {
// '@': path.resolve(__dirname, './src'),
'@assets': path.resolve(__dirname, 'src/assets'),
'@utils': path.resolve(__dirname, './src/utils'),
'@modules': path.resolve(__dirname, 'src/modules'),
'@pages': path.resolve(__dirname, './src/pages'),
'@router': path.resolve(__dirname, './src/router'),
'@stores': path.resolve(__dirname, 'src/stores'),
'@models': path.resolve(__dirname, './src/models'),
'@hooks': path.resolve(__dirname, './src/hooks'),
'@components': path.resolve(__dirname, './src/components'),
'@services': path.resolve(__dirname, './src/services'),
},
},
build: {},
});
};