Files
stock-scanner/frontend/vite.config.ts
2025-03-08 04:20:22 +08:00

34 lines
730 B
TypeScript
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 { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath } from 'url'
import { dirname, resolve } from 'path'
// 获取当前文件的目录路径在ESM中替代__dirname
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
},
server: {
cors: true,
hmr: {
// 解决WebSocket连接问题
host: 'localhost',
port: 5173,
protocol: 'ws'
},
proxy: {
'/api': {
target: 'http://127.0.0.1:8888',
changeOrigin: true,
}
},
},
})