import { resolve } from "node:path"
import ui from "@nuxt/ui/vite"
import tailwindcss from "@tailwindcss/vite"
import vue from "@vitejs/plugin-vue"
import { defineConfig } from "vite"

export default defineConfig({
  plugins: [vue(), tailwindcss(), ui()],
  resolve: {
    alias: [{ find: /^@\//, replacement: `${resolve(__dirname, "src")}/` }],
  },
  build: {
    lib: {
      entry: resolve(__dirname, "src/index.ts"),
      fileName: "index",
      formats: ["es"],
    },
    rollupOptions: {
      external: ["vue", "@nuxt/ui", "tailwindcss", "pinia"],
    },
    cssCodeSplit: false,
    cssMinify: "lightningcss",
  },
})
