import { resolve } from "node:path"

const EDITOR_ROOT = resolve(__dirname, "../../packages/editor")

export default defineNuxtConfig({
  ssr: false,

  modules: ["@nuxt/ui", "@pinia/nuxt"],

  css: ["~/assets/main.css", `${EDITOR_ROOT}/src/assets/style.css`],

  colorMode: {
    classSuffix: "",
  },

  devServer: { host: "0" },
  srcDir: "src/",
  ignore: ["**/src-tauri/**"],

  app: {
    head: {
      title: "Enesis Editor",
      link: [{ rel: "icon", type: "image/svg+xml", href: "/favicon.svg" }],
    },
  },

  vite: {
    clearScreen: false,
    envPrefix: ["VITE_", "TAURI_"],
    server: {
      strictPort: true,
    },
    resolve: {
      alias: [
        { find: /^@\//, replacement: `${EDITOR_ROOT}/src/` },
        { find: "@enesis/editor", replacement: `${EDITOR_ROOT}/src/index.ts` },
      ],
    },
  },

  compatibilityDate: "2025-06-01",
})
