import vue from "@vitejs/plugin-vue";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { VantResolver } from "@vant/auto-import-resolver";
import tailwindcss from "@tailwindcss/vite";
import viteLegacy from "@vitejs/plugin-legacy";
import viteVueJsx from "@vitejs/plugin-vue-jsx";
import path from "path";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [VantResolver()],
    }),
    Components({
      resolvers: [VantResolver()],
    }),
    viteLegacy(),
    viteVueJsx(),
    tailwindcss(),
  ],
  resolve: {
    alias: {
      "@": path.join(__dirname, "./src"),
    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        api: "modern-compiler",
        silenceDeprecations: ["legacy-js-api"],
      },
    },
  },
  server: {
    host: "0.0.0.0",
    port: 5174,
    open: false,
    proxy: {
      "/ingress": {
        // target: "https://abroadbiz.nianxx.com",
        target: "https://onefeel.brother7.cn",
        changeOrigin: true,
        ws: true,
        secure: false,
      },
    },
  },
});
