import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "node:path";

export default () => {
  return defineConfig({
    plugins: [react()],
    server: {
      host: "0.0.0.0",
      hmr: {
        port: 443,
      },
      proxy: {
        "/api": "http://localhost:52000",
        "/socket.io": {
          target: "ws://localhost:52000",
          ws: true,
        },
      },
    },
    build: {
      outDir: "./build",
    },
    base: "/qualiteer/",
    resolve: {
      alias: {
        "@qltr/util": path.resolve("./src/util/"),
        "@qltr/queries": path.resolve("./src/util/queries"),
        "@qltr/jobs": path.resolve("./src/ctx/JobContext.jsx"),
        "@qltr/store": path.resolve("./src/ctx/StoreContext.jsx"),
        "@qltr/initiator": path.resolve("./lib/sockets/clients/Initiator.js"),
      },
    },
  });
};
