Files
OpenAvatarChat-WebUI/vite.config.ts
bingochaos 3fddf021be Init frontend (#1)
更新静态资源
2025-08-07 18:18:54 +08:00

71 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import legacyPlugin from '@vitejs/plugin-legacy'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
// import mkcert from 'vite-plugin-mkcert'
import { join } from 'path'
// server of your OpenAvatarChat
const serverIP = '127.0.0.1'
const serverPort = '8282'
// https://vitejs.dev/config/
export default defineConfig({
base: './',
build: {
rollupOptions: {
// input: {
// index: resolve(__dirname, 'index.html'),
// cropImage: resolve(__dirname, 'cropImage.html')
// },
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[name].[ext]`,
},
},
},
server: {
// host: '0.0.0.0',
// https: true,
// port: 443,
proxy: {
'/download': {
target: `https://${serverIP}:${serverPort}`,
changeOrigin: true,
secure: false,
},
'/openavatarchat': {
target: `https://${serverIP}:${serverPort}`,
changeOrigin: true,
secure: false,
},
'/webrtc/offer': {
target: `https://${serverIP}:${serverPort}`,
changeOrigin: true,
secure: false,
},
'/ws': {
target: `wss://${serverIP}:${serverPort}`,
ws: true,
rewriteWsOrigin: true,
secure: false,
},
},
},
plugins: [
vue(),
// 本地开发如果需要https才能走通接口的话则需要开启mkcert,并且开启mkcert需要sudo权限
// mkcert({
// source: 'coding'
// }),
legacyPlugin({
modernPolyfills: true,
}),
],
resolve: {
alias: {
'@': join(__dirname, 'src'),
},
},
})