Files
open-anylink-web/vite.config.js
2025-05-12 21:12:12 +08:00

54 lines
1.3 KiB
JavaScript
Raw Permalink 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 { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import svgLoader from 'vite-svg-loader'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
vueJsx({
transformOn: true,
optimize: true
}),
svgLoader()
],
base: '/im',
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
// 配置代理
server: {
proxy: {
'/api': {
// 获取请求中带 /api 的请求
target: 'http://localhost:8080', // 后台服务器的源
changeOrigin: true // 修改源
},
'/ws': {
// 获取请求中带 /api 的请求
target: 'ws://localhost:8080', // 后台服务器的源
changeOrigin: true // 修改源
},
'/oss/': {
// 获取图片的请求
target: 'http://127.0.0.1:9001', // 对象存储oss的源
changeOrigin: true, // 修改源
rewrite: (path) => path.replace(/^\/oss\//, '')
}
}
},
// 屏蔽告警The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler'
}
}
}
})