generated from vu3th/vue-dapp-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
42 lines (37 loc) · 1000 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
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import { join, resolve } from 'path';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
export default ({ mode }) => {
process.env = {...process.env, ...loadEnv(mode, process.cwd())};
return defineConfig({
plugins: [
vue(),
createSvgIconsPlugin({
// 指定需要缓存的图标文件夹
iconDirs: [resolve(process.cwd(), 'src/assets/images/svg')],
// 指定symbolId格式
symbolId: 'icon-[dir]-[name]',
})
],
resolve: {
alias: {
'@': join(__dirname, 'src') // setting alias
}
},
base: './', // 设置打包路径
server: {
port: 4000, // port
cors:true,
// proxy
proxy: {
'/api': {
target: process.env.VITE_CONFIG_URL,
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace('/api/', '/')
}
}
}
});
}