import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { fileURLToPath, URL } from 'node:url' export default defineConfig({ plugins: [vue()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, server: { proxy: { '/baidu': { target: 'https://finance.pae.baidu.com', changeOrigin: true, rewrite: (path) => path.replace(/^\/baidu/, ''), headers: { Referer: 'https://gushitong.baidu.com/', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', }, }, '/jqka': { target: 'https://fupage.10jqka.com.cn', changeOrigin: true, rewrite: (path) => path.replace(/^\/jqka/, ''), }, }, }, })