import path from "path";
import { defineConfig } from "vite";

import PurgeIcons from "vite-plugin-purge-icons";

export default defineConfig({
  root: "./src",
  base: "./",
  plugins: [PurgeIcons()],
  build: {
    manifest: true,
    rollupOptions: {
      input: path.resolve(__dirname, "src/main.ts"),
      output: {
        entryFileNames: "[name].js",
        chunkFileNames: "[name].js",
        assetFileNames: "[name][extname]",
      },
      treeshake: false,
      preserveEntrySignatures: "allow-extension",
    },
    outDir: path.resolve(__dirname, "templates/assets/dist"),
    emptyOutDir: true,
  },
});