rax-medical/vite.config.ts

45 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-06-18 09:15:00 +08:00
import {fileURLToPath, URL} from 'node:url'
2023-11-10 17:45:10 +08:00
2025-06-18 09:15:00 +08:00
import {defineConfig} from 'vite'
2023-11-10 17:45:10 +08:00
import vue from '@vitejs/plugin-vue'
2025-06-18 09:15:00 +08:00
import fs from 'fs';
import path from 'path';
2023-11-10 17:45:10 +08:00
// https://vitejs.dev/config/
export default defineConfig({
2025-06-18 09:15:00 +08:00
// base: '/medical/',
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "./src/assets/css/variable.scss";' //引入scss文件
}
}
},
server: {
proxy: {
'/api': {
2025-07-14 09:30:16 +08:00
target: 'http://127.0.0.1:6679', // 目标服务器地址
2025-07-04 12:40:37 +08:00
// target: 'http://110.41.142.124:6379', // 目标服务器地址
2025-06-18 09:15:00 +08:00
ws: true, // 是否启用 WebSocket
changeOrigin: true, // 是否修改请求头中的 Origin 字段
rewrite: (path) => path.replace(/^\/api/, ''),
},
'/socket.io': {
2025-07-14 09:30:16 +08:00
target: 'ws://127.0.0.1:6679',
2025-07-04 12:40:37 +08:00
// target: 'ws://110.41.142.124:6379',
2025-06-18 09:15:00 +08:00
ws: true,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/socket.io/, ''),
},
}
2024-03-13 16:54:09 +08:00
}
2023-11-10 17:45:10 +08:00
})