import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { viteSingleFile } from 'vite-plugin-singlefile';
import { resolve } from 'path';

// Build target is set via VITE_APP env var: search | results | dashboard
// Default: builds all sequentially via the build script
const app = process.env.VITE_APP || 'search';

export default defineConfig({
  plugins: [react(), viteSingleFile()],
  build: {
    outDir: 'dist',
    emptyOutDir: false,
    rollupOptions: {
      input: resolve(__dirname, `${app}.html`),
    },
  },
});
