


import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import vuetify from "vite-plugin-vuetify"
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js"
import path from "node:path"

export default defineConfig({
  plugins: [
    vue(),
    vuetify({ autoImport: true }),
    cssInjectedByJsPlugin(),
  ],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  build: {
    lib: {
      entry: path.resolve(__dirname, "src/index.ts"),
      name: "eli_vue",
      fileName: (format) => `eli-vue.${format}.js`,
    },
    rollupOptions: {
      // não bundle o Vue
      external: ["vue", /^vuetify(\/.*)?$/],
      output: {
        globals: {
          vue: "Vue",
          vuetify: "Vuetify",
        },
        exports: "named",
      },
    },
  },
})
