const { build } = require('esbuild')
const dotenv = require('dotenv')
const path = require('path')

dotenv.config()

build({
  entryPoints: ['src/index.ts'],
  bundle: true,
  minify: true,
  platform: 'node',
  target: 'node18',
  outfile: 'dist/index.js',
  define: {
    'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
    'process.env.BASE_API_QIVOPAY': JSON.stringify(process.env.BASE_API_QIVOPAY || 'https://api.qivopay.com'),
  },
  external: ['aws-sdk'],
}).catch(() => process.exit(1))