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({
  server:{
    host:'0.0.0.0',
    // proxy: { // 配置域名代理
    //   "/api": {
    //     target: "http://192.168.0.100:9064",
    //     changeOrigin: true,
    //     rewrite: (path) => path.replace(/^\/api/, ""),
    //   },
    // },
  },
  resolve: {
    alias: {
      '@': resolve('./src')
    }
  },
  base: './', // 打包路径

  plugins: [
    vue(),
    vueJsx(),
    legacy({
      targets: ["ie >= 11"],
      additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
    }),
    // viteMocker({
    //   dir: "/mocks",
    //   pattern: "/mock",
    //   delay: [0, 200],
    // }),
  ],
 
});
