import { defineConfig } from "vite";
import tailwindcss from "@tailwindcss/vite";
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
import { viteSingleFile } from "vite-plugin-singlefile";
import ansi from "./vite-plugin-ansi";

export default defineConfig({
  plugins: [
    ansi(),
    tailwindcss(),
    wasm(),
    topLevelAwait(),
    viteSingleFile({ useRecommendedBuildConfig: false }),
  ],
  resolve: {
    alias: {
      "~": "/src",
    },
  },
  server: {
    headers: {
      "Cross-Origin-Opener-Policy": "same-origin",
      "Cross-Origin-Embedder-Policy": "require-corp",
    },
  },
  preview: {
    headers: {
      "Cross-Origin-Opener-Policy": "same-origin",
      "Cross-Origin-Embedder-Policy": "require-corp",
    },
  },
  build: {
    target: "esnext",
    assetsInlineLimit: 0,
    cssCodeSplit: false,
  },
});
