import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
import ElementPlus from "unplugin-element-plus/vite";
import { viteMockServe } from "vite-plugin-mock";
import vueJsx from '@vitejs/plugin-vue-jsx';

// https://vitejs.dev/config/
export default defineConfig({
  base: './',
  plugins: [
    vue(),
    ElementPlus({}),
    viteMockServe({
      mockPath: "./src/mock",
      enable: true,
      watchFiles: true
    }),
    vueJsx(),
  ],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
      "~@": path.resolve(__dirname, "src"),
      "#": path.resolve(__dirname, "types"),
    },
  },
  css: {
    preprocessorOptions: {
      less: {
        additionalData: `@import "~@/style/var.less";`,
      },
    },
  },
  server: {
    port: 3000,
  }
});
