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

const require = createRequire(import.meta.url);
const svgo = require("vite-plugin-svgo");

export default defineConfig({
  base: "./",
  publicDir: path.resolve(__dirname, "public"),
  plugins: [react(), svgr(), svgo()],
  root: path.resolve(__dirname),
  build: {
    outDir: path.resolve(__dirname, "../../dist/app"),
    emptyOutDir: true,
    rollupOptions: {
      input: {
        main: path.resolve(__dirname, "index.html"),
      },
    },
  },
  server: {
    port: 5287,
  },
});
