import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';

export default defineConfig({
  plugins: [
    svelte({
      compilerOptions: {
        css: 'injected',
      },
    }),
  ],
  build: {
    lib: {
      entry: 'src/main.ts',
      name: 'FlowDropAiContext',
      formats: ['iife'],
      fileName: () => 'context-selector-field.js',
    },
    outDir: 'build',
    emptyOutDir: true,
    minify: 'terser',
    terserOptions: {
      compress: {
        drop_console: true,
      },
    },
    rollupOptions: {
      output: {
        assetFileNames: 'context-selector-field[extname]',
      },
    },
  },
});
