feat: init commit

This commit is contained in:
merlin
2025-10-16 16:52:08 +08:00
commit 7f2142c80f
32 changed files with 4717 additions and 0 deletions

59
vite.config.js Normal file
View File

@@ -0,0 +1,59 @@
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
server: {
proxy: {
"/api": {
target: "http://localhost:8080", // 后端服务器地址
changeOrigin: true, // 允许跨域
rewrite: (path) => path.replace(/^\/api/, ""), // 重写路径,去掉 /api 前缀
},
"/proxy": {
target: "http://localhost:3000", // 代理服务器的地址
changeOrigin: true, // 必须设置为 true才能避免跨域问题
// rewrite: (path) => path.replace(/^\/proxy/, ''), // 重写路径,去掉 /api 前缀
},
"/online": {
target: "ws://localhost:8080",
changeOrigin: true,
ws: true,
},
"/voice": {
target: "ws://localhost:8080",
changeOrigin: true,
ws: true,
},
},
},
// server: {
// https:{
// key: fs.readFileSync('./cert/merlin.xin.key'),
// cert: fs.readFileSync('./cert/merlin.xin.pem'),
// },
// proxy: {
// '/api': {
// target: 'https://localhost:8443', // 后端服务器地址
// changeOrigin: true, // 允许跨域
// rewrite: (path) => path.replace(/^\/api/, ''), // 重写路径,去掉 /api 前缀
// },
// '/online':{
// target:'wss://localhost:8443/online',
// changeOrigin:true,
// ws:true,
// },
// '/voice':{
// target:'wss://localhost:8443/voice',
// changeOrigin:true,
// ws:true,
// }
// },
// },
});