56 lines
1.5 KiB
TypeScript
Executable File
56 lines
1.5 KiB
TypeScript
Executable File
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import path from 'path'
|
|
import Inspector from 'unplugin-vue-dev-locator/vite'
|
|
import xiPlusBadge from 'vite-plugin-xi-plus-badge'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
build: {
|
|
sourcemap: 'hidden',
|
|
},
|
|
plugins: [
|
|
vue(),
|
|
Inspector(),
|
|
xiPlusBadge({
|
|
text: 'XI PLUS', // 角标文本
|
|
link: 'https://xi.plus', // 点击跳转链接
|
|
position: 'bottom-right', // 角标位置
|
|
showInDev: true, // 开发环境显示
|
|
showInProd: true // 生产环境显示
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'), // ✅ 定义 @ = src
|
|
},
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5174,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:4001',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
configure: (proxy, _options) => {
|
|
proxy.on('error', (err, _req, _res) => {
|
|
console.log('proxy error', err);
|
|
});
|
|
proxy.on('proxyReq', (proxyReq, req, _res) => {
|
|
console.log('Sending Request to the Target:', req.method, req.url);
|
|
});
|
|
proxy.on('proxyRes', (proxyRes, req, _res) => {
|
|
console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
|
|
});
|
|
},
|
|
},
|
|
'/uploads': {
|
|
target: 'http://localhost:4001',
|
|
changeOrigin: true,
|
|
secure: false
|
|
}
|
|
}
|
|
}
|
|
})
|