mirror of
https://gitee.com/goploy/goploy.git
synced 2024-11-30 03:07:59 +08:00
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { defineConfig, loadEnv, ConfigEnv, UserConfigExport } from 'vite'
|
|
import path from 'path'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import vueI18n from '@intlify/vite-plugin-vue-i18n'
|
|
import viteSvgIcons from 'vite-plugin-svg-icons'
|
|
// https://vitejs.dev/config/
|
|
export default ({ mode }: ConfigEnv): UserConfigExport => {
|
|
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
|
|
return defineConfig({
|
|
resolve: {
|
|
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }],
|
|
},
|
|
plugins: [
|
|
vue(),
|
|
vueI18n({
|
|
include: path.resolve(__dirname, './src/lang/**'),
|
|
}),
|
|
viteSvgIcons({
|
|
// Specify the icon folder to be cached
|
|
iconDirs: [path.resolve(__dirname, './src/icons/svg')],
|
|
// Specify symbolId format
|
|
symbolId: 'icon-[dir]-[name]',
|
|
}),
|
|
],
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 8000,
|
|
proxy: {
|
|
// change xxx-api/login => mock/login
|
|
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
|
[process.env.VITE_APP_BASE_API]: {
|
|
target: process.env.VITE_APP_PROXY_TARGET,
|
|
changeOrigin: true,
|
|
rewrite: (path) => {
|
|
const reg = RegExp('^' + process.env.VITE_APP_BASE_API)
|
|
return path.replace(reg, '')
|
|
},
|
|
ws: true,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
}
|