// vite.config.ts
import { fileURLToPath, URL } from "node:url";
import { defineConfig, loadEnv } from "file:///C:/Users/milo/Desktop/app/jg/node_modules/vite/dist/node/index.js";

// build/plugins.ts
import path from "node:path";
import VueI18nPlugin from "file:///C:/Users/milo/Desktop/app/jg/node_modules/@intlify/unplugin-vue-i18n/lib/vite.mjs";
import vue from "file:///C:/Users/milo/Desktop/app/jg/node_modules/@vitejs/plugin-vue/dist/index.mjs";
import vueJsx from "file:///C:/Users/milo/Desktop/app/jg/node_modules/@vitejs/plugin-vue-jsx/dist/index.mjs";
import UnoCSS from "file:///C:/Users/milo/Desktop/app/jg/node_modules/unocss/dist/vite.mjs";
import AutoImport from "file:///C:/Users/milo/Desktop/app/jg/node_modules/unplugin-auto-import/dist/vite.js";
import { ElementPlusResolver } from "file:///C:/Users/milo/Desktop/app/jg/node_modules/unplugin-vue-components/dist/resolvers.js";
import Components from "file:///C:/Users/milo/Desktop/app/jg/node_modules/unplugin-vue-components/dist/vite.js";
import compressPlugin from "file:///C:/Users/milo/Desktop/app/jg/node_modules/vite-plugin-compression/dist/index.mjs";
var __vite_injected_original_dirname = "C:\\Users\\milo\\Desktop\\app\\jg\\build";
var configCompressPlugin = function(compress) {
  if (compress === "none") {
    return null;
  }
  const config = {
    threshold: 10240,
    filter: (file) => {
      return /\.(?:js|css|html|json|xml|svg|wasm|woff|woff2)$/.test(file);
    },
    deleteOriginFile: false
  };
  if (compress === "brotli") {
    config.ext = ".br";
    config.algorithm = "brotliCompress";
  }
  return compressPlugin(config);
};
function createVitePlugins(env) {
  return [
    vue(),
    vueJsx(),
    UnoCSS(),
    AutoImport({
      dts: "src/typings/auto-imports.d.ts",
      imports: ["vue", "vue-router", "pinia", "@vueuse/core"],
      resolvers: [ElementPlusResolver()]
    }),
    Components({
      dts: "src/typings/components.d.ts",
      extensions: ["vue", "tsx"],
      dirs: ["src/components"],
      resolvers: [ElementPlusResolver()]
    }),
    VueI18nPlugin({
      include: path.resolve(__vite_injected_original_dirname, "../src/locales/**")
    }),
    configCompressPlugin(env.VITE_COMPRESSION)
  ];
}

// vite.config.ts
import Components2 from "file:///C:/Users/milo/Desktop/app/jg/node_modules/unplugin-vue-components/dist/vite.js";
import { ElementPlusResolver as ElementPlusResolver2 } from "file:///C:/Users/milo/Desktop/app/jg/node_modules/unplugin-vue-components/dist/resolvers.js";
var __vite_injected_original_import_meta_url = "file:///C:/Users/milo/Desktop/app/jg/vite.config.ts";
var vite_config_default = defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd(), "");
  return {
    base: "./",
    // 让 CSS 文件路径正确
    ssr: {
      noExternal: ["some-package"]
      // 确保 CSS 相关的库不会被 SSR 处理
    },
    plugins: [
      createVitePlugins(env),
      Components2({
        resolvers: [ElementPlusResolver2()]
      })
    ],
    resolve: {
      alias: {
        "@": fileURLToPath(new URL("./src", __vite_injected_original_import_meta_url)),
        "@iconify-icons": "/node_modules/@iconify-icons"
        // 设置正确的路径
      }
    },
    server: {
      host: "0.0.0.0",
      proxy: {
        "/api": {
          target: env.VITE_BASE_URL,
          changeOrigin: true,
          rewrite: (path2) => path2.replace(/^\/api/, "")
        },
        // 未知量  //振动、激光测距仪
        "/WZLapi": {
          target: "http://192.168.50.241:9001",
          // WZLapi 目标地址
          // target: "http://106.120.102.238:18080/WindTransDev", // WZLapi 外网目标地址
          changeOrigin: true,
          rewrite: (path2) => path2.replace(/^\/WZLapi/, "")
        }
      },
      css: {
        preprocessorOptions: {
          scss: {
            api: "modern-compiler"
          }
        }
      }
    }
  };
});
export {
  vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,[encoded data, 8496 characters]
