import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
// import vueJsx from "@vitejs/plugin-vue-jsx";

function pathResolve(dir: string) {
  return resolve(process.cwd(), ".", dir);
}
// eslint-disable-next-line @typescript-eslint/no-var-requires
// const path = require("path");

// function resolve(dir: string) {
//   return path.join(__dirname, dir);
// }
const proxyUrl = "https://test.lexiaoya.cn";
// https://vitejs.dev/config/
export default defineConfig({
  base: "./",
  plugins: [vue()],
  resolve: {
    alias: {
      // '@': resolve('/src'),
      // '@components': resolve('/src/components'),
      // '@views': resolve('/src/views')
      "@": pathResolve("src") + "/",
      "@components": pathResolve("src/components") + "/",
      "@views": pathResolve("src/views") + "/",
    },
  },
  server: {
    host: "0.0.0.0",
    strictPort: true,
    cors: true,
    https: false,
    proxy: {
      "/edu-app": {
        target: proxyUrl,
        changeOrigin: true,
      },
    },
  },
});
