import { defineConfig } from "vite";
import { resolve } from "path";
import vue from "@vitejs/plugin-vue";
import dts from "vite-plugin-dts";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    dts({
      tsconfigPath: "./tsconfig.json",
      rollupTypes: true,
      outDir: './typings',
      insertTypesEntry: true,
    }),
  ],
  build: {
    outDir: "lib",
    sourcemap: true,
    manifest: true,
    minify: true,
    lib: {
      formats: ["cjs", "es", "umd"],
      entry: resolve(__dirname, "./components/index.ts"),
      name: "shaluDashboardUi",
      fileName: "shalu-dashboard-ui",
    },
    rollupOptions: {
      external: ["vue"],
      output: {
        globals: {
          vue: "Vue",
        },
      },
    },
  },
});
