import { defineConfig } from 'tsup'

export default defineConfig([
  // Main bundle with web components
  {
    entry: ['src/index.ts'],
    format: ['cjs', 'esm'],
    dts: true,
    splitting: false,
    sourcemap: true,
    clean: true,
    treeshake: true,
  },
  // Embed script (IIFE for <script> tag usage)
  {
    entry: ['src/embed.ts'],
    format: ['iife'],
    globalName: 'BreakPilotSDK',
    outDir: 'dist',
    minify: true,
    sourcemap: true,
    outExtension: () => ({ js: '.min.js' }),
  },
  // Embed script (ESM for modern usage)
  {
    entry: ['src/embed.ts'],
    format: ['esm', 'cjs'],
    dts: false,
    splitting: false,
    sourcemap: true,
  },
])
