// packages/app/esbuild.config.ts
import { build } from 'esbuild';

async function compile() {
  try {
    await build({
      entryPoints: ['src/index.ts'], // Your Express server entry point
      bundle: true,
      platform: 'node',
      target: ['node22'],             // Adjust based on your Node version
      outdir: 'dist',
      sourcemap: true,
      // Optionally, you can exclude external dependencies such as AWS SDK if needed.
      // external: ['aws-sdk'],
      minify: true,                  // Change to true for a production minified bundle
    });
    console.log('Build succeeded.');
  } catch (error) {
    console.error('Build failed:', error);
    process.exit(1);
  }
}

compile();
