const { createServer } = require('esbuild-server');
const server = createServer(
{
bundle: true,
entryPoints: ['src/index.js'],
},
{
static: 'public',
...(process.argv.slice(2).includes('--test')) && { port: 3005 }
}
);
const buildStart = Date.now();
server
.start()
.then(() => {
console.log(`Build completed in ${Date.now() - buildStart}ms`);
})
.catch(() => {
console.error('Build failed');
});
console.log(`Development server running at ${server.url}`);