esbuild.config.js•815 B
const { build } = require('esbuild');
const { nodeExternalsPlugin } = require('esbuild-node-externals');
const isProduction = process.argv.includes('--production');
async function buildProject() {
await build({
entryPoints: ['src/index.ts'],
bundle: true,
platform: 'node',
target: 'node22',
outfile: 'dist/index.js',
external: ['@modelcontextprotocol/sdk'],
minify: isProduction,
sourcemap: !isProduction,
treeShaking: true,
banner: {
js: `
// Watchtower MCP Server - Windows-native DAP bridge
// ${isProduction ? 'Production' : 'Development'} Build
`,
},
plugins: [
nodeExternalsPlugin(),
],
define: {
'process.env.NODE_ENV': isProduction ? '"production"' : '"development"',
},
});
}
buildProject().catch(() => process.exit(1));