import { defineConfig } from 'vite';
import { resolve } from 'path';
import terser from '@rollup/plugin-terser';

export default defineConfig({
  build: {
    lib: {
      entry: resolve(__dirname, 'src/index.js'),
      name: 'ApigoLoader',
      formats: ['umd', 'es']
    },
    rollupOptions: {
      output: [
        {
          format: 'umd',
          name: 'ApigoLoader',
          entryFileNames: 'loader.js'
        },
        {
          format: 'umd',
          name: 'ApigoLoader',
          entryFileNames: 'loader.min.js',
          plugins: [terser()]
        },
        {
          format: 'es',
          entryFileNames: 'loader.mjs'
        },
        {
          format: 'es',
          entryFileNames: 'loader.min.mjs',
          plugins: [terser()]
        }
      ]
    },
    minify: false
  }
});
