// vite.config.mjs
import { resolve } from "path";
import { defineConfig, loadEnv } from "file:///E:/QHdemo/province-vue-all/node_modules/vite/dist/node/index.js";
import vue from "file:///E:/QHdemo/province-vue-all/node_modules/@vitejs/plugin-vue/dist/index.mjs";
import Components from "file:///E:/QHdemo/province-vue-all/node_modules/unplugin-vue-components/dist/vite.js";
import VueJSX from "file:///E:/QHdemo/province-vue-all/node_modules/@vitejs/plugin-vue-jsx/dist/index.mjs";
import AutoImport from "file:///E:/QHdemo/province-vue-all/node_modules/unplugin-auto-import/dist/vite.js";
import vueSetupExtend from "file:///E:/QHdemo/province-vue-all/node_modules/vite-plugin-vue-setup-extend/dist/index.mjs";
import { visualizer } from "file:///E:/QHdemo/province-vue-all/node_modules/rollup-plugin-visualizer/dist/plugin/index.js";
import Less2CssVariablePlugin from "file:///E:/QHdemo/province-vue-all/node_modules/antd-less-to-css-variable/dist/index.js";
import viteCompression from "file:///E:/QHdemo/province-vue-all/node_modules/vite-plugin-compression/dist/index.mjs";
var __vite_injected_original_dirname = "E:\\QHdemo\\province-vue-all";
var r = (...args) => resolve(__vite_injected_original_dirname, ".", ...args);
var vite_config_default = defineConfig(({ command, mode }) => {
  const envConfig = loadEnv(mode, "./");
  const alias = {
    "~": `${resolve(__vite_injected_original_dirname, "./")}`,
    "@/": `${resolve(__vite_injected_original_dirname, "src")}/`
  };
  return {
    server: {
      port: envConfig.VITE_PORT,
      proxy: {
        "/api": {
          target: envConfig.VITE_API_BASEURL,
          ws: false,
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/api/, "")
        }
      }
    },
    resolve: {
      alias
    },
    // 解决警告You are running the esm-bundler build of vue-i18n.
    define: {
      __VUE_I18N_FULL_INSTALL__: true,
      __VUE_I18N_LEGACY_API__: true,
      __VUE_I18N_PROD_DEVTOOLS__: true
    },
    build: {
      // sourcemap: true,
      manifest: true,
      brotliSize: false,
      rollupOptions: {
        output: {
          manualChunks: {
            echarts: ["echarts"],
            "ant-design-vue": ["ant-design-vue"],
            vue: ["vue", "vue-router", "pinia", "vue-i18n"]
          }
        }
      },
      chunkSizeWarningLimit: 1e3
    },
    plugins: [
      vue({
        script: {
          refTransform: true
        }
      }),
      viteCompression(),
      vueSetupExtend(),
      VueJSX(),
      AutoImport({
        imports: ["vue"],
        dirs: ["./src/utils/permission"],
        dts: r("src/auto-imports.d.ts")
      }),
      // 组件按需引入
      Components({
        dirs: [r("src/components")],
        dts: false,
        resolvers: []
      }),
      visualizer()
    ],
    css: {
      preprocessorOptions: {
        less: {
          javascriptEnabled: true,
          plugins: [new Less2CssVariablePlugin()]
        }
      }
    },
    optimizeDeps: {}
  };
});
export {
  vite_config_default as default,
  r
};
//# sourceMappingURL=data:application/json;base64,[encoded data, 8500 characters]
