forked from Simnation/Main
23 lines
544 B
JavaScript
23 lines
544 B
JavaScript
import { build } from 'esbuild'
|
|
|
|
const production = process.argv.includes('--mode=production')
|
|
|
|
build({
|
|
entryPoints: ['src/index.ts'],
|
|
outfile: './dist/server.js',
|
|
bundle: true,
|
|
loader: {
|
|
'.ts': 'ts',
|
|
'.js': 'js',
|
|
},
|
|
write: true,
|
|
platform: 'node',
|
|
target: 'node16',
|
|
sourcemap: production ? false : 'inline',
|
|
dropLabels: production ? ['DEV'] : undefined,
|
|
})
|
|
.then(() => {
|
|
console.log('Server built successfully')
|
|
})
|
|
// skipcq: JS-0263
|
|
.catch(() => process.exit(1))
|