import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import ElementPlus from "unplugin-element-plus/vite";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    ElementPlus({
      // options
    }),
  ],
  resolve: {
    alias: {
      // vue: resolve(`./node_modules/vue`),
      "@": resolve("./src"),
    },
  },
  server: {
    proxy: {
      "^/api": {
        target: "http://183.134.99.140:46790/",
        // target: "http://121.37.141.165:46790/",
        // target: "https://sy.8n.cn/api",
        changeOrigin: true,
      },
      "^/proxyPdf": {
        target:
          "https://zbzb.s3.ap-northeast-1.amazonaws.com/yuan.org/ycc/white-paper/zh.pdf",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/proxyPdf/, ""),
      },
    },
  },
});
