Files
open-anylink-web/vite.config.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

2024-08-19 22:51:18 +08:00
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
2024-10-23 15:33:58 +08:00
import svgLoader from 'vite-svg-loader'
2024-08-19 22:51:18 +08:00
// https://vitejs.dev/config/
export default defineConfig({
2024-10-23 15:33:58 +08:00
plugins: [vue(), svgLoader()],
2025-03-08 19:13:48 +08:00
base: '/im',
2024-08-19 22:51:18 +08:00
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
2024-08-21 10:37:56 +08:00
},
// 配置代理
server: {
proxy: {
'/api': {
// 获取请求中带 /api 的请求
2025-02-18 21:32:48 +08:00
target: 'http://localhost:8080', // 后台服务器的源
changeOrigin: true // 修改源
2025-02-24 12:30:40 +08:00
},
2025-03-13 21:38:52 +08:00
'/ws': {
// 获取请求中带 /api 的请求
target: 'ws://localhost:8080', // 后台服务器的源
changeOrigin: true // 修改源
},
2025-02-24 12:30:40 +08:00
'/oss/': {
// 获取图片的请求
2025-03-26 09:14:03 +08:00
target: 'http://127.0.0.1:9001', // 对象存储oss的源
2025-02-24 12:30:40 +08:00
changeOrigin: true, // 修改源
rewrite: (path) => path.replace(/^\/oss\//, '')
2024-08-21 10:37:56 +08:00
}
2025-02-17 16:07:04 +08:00
}
},
// 屏蔽告警The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler'
}
}
2024-08-19 22:51:18 +08:00
}
})