Files
open-anylink-web/vite.config.js
2025-02-17 16:07:04 +08:00

35 lines
855 B
JavaScript
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 { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import svgLoader from 'vite-svg-loader'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), svgLoader()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
// 配置代理
server: {
proxy: {
'/api': {
// 获取请求中带 /api 的请求
target: 'http://localhost', // 后台服务器的源
changeOrigin: true, // 修改源
rewrite: (path) => path.replace(/^\/api/, '') // /api 替换为空字符串
}
}
},
// 屏蔽告警The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler'
}
}
}
})