import { defineConfig, UserConfigExport } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import legacy from "@vitejs/plugin-legacy";
// import viteMocker from "vite-plugin-mocker";
import { resolve } from 'path'

export default defineConfig({
  resolve: {
    alias: {
      '@': resolve('./src')
    }
  },
  base: './', // 打包路径

  plugins: [
    vue(),
    vueJsx(),
    legacy({
      targets: ["ie >= 11"],
      additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
    }),
    // viteMocker({
    //   dir: "/mocks",
    //   pattern: "/mock",
    //   delay: [0, 200],
    // }),
  ],
  server: {
    // proxy: { // 配置域名代理
    //   "/api": {
    //     target: "http://jsonplaceholder.typicode.com",
    //     changeOrigin: true,
    //     rewrite: (path) => path.replace(/^\/api/, ""),
    //   },
    // },
  },
});
