12345678910111213141516171819202122232425262728293031 |
- import { defineConfig } from "vite";
- import vue from "@vitejs/plugin-vue";
- import { resolve } from "path";
- const pathResolve = (dir: string) => {
- return resolve(process.cwd(), ".", dir);
- };
- // https://vitejs.dev/config/
- export default defineConfig({
- resolve: {
- alias: [
- {
- find: "@",
- replacement: pathResolve("src"),
- },
- ],
- dedupe: ["vue"],
- },
- plugins: [vue()],
- server: {
- proxy: {
- // 代理配置
- '/api': {
- target: 'http://localhost:8083', // 目标服务器
- changeOrigin: true, // 需要虚拟主机站点
- rewrite: (path) => path.replace(/^\/api/, '/api/') // 重写 API 请求
- }
- }
- }
- });
|