import * as esbuild from 'esbuild';

async function build() {
  try {
    await esbuild.build({
      entryPoints: ['wwwroot/ts/app.ts'],
      bundle: true,
      outfile: 'wwwroot/js/app.js',
      format: 'esm',
      sourcemap: 'inline',
      target: 'es2020',
      minify: false,
      keepNames: true,
      platform: 'browser'
    });

    console.log('App bundle created: wwwroot/js/app.js');
  } catch (error) {
    console.error('Build failed:', error);
    process.exit(1);
  }
}

build();
