import child_process from "child_process";
import legacy from "@vitejs/plugin-legacy";
import os from "os";

/**
 * @type {import('vite').UserConfig}
 */
const config = {
  base: "./",
  define: {
    __APP_VERSION__: `"${child_process
      .execSync("git rev-parse --short HEAD")
      .toString()
      .replace("\n", "")}"`,
    __APP_BUILD_TIME__: Math.floor(Date.now() / 1000),
    __APP_BUILD_MACHINE__:`"${os.hostname}"`
  },
  plugins: [
    legacy({
      targets: ["ie >= 11"],
      additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
    }),
  ],
};
export default config;
