28 lines
598 B
JavaScript
28 lines
598 B
JavaScript
import * as esbuild from 'esbuild'
|
|
|
|
const production = process.argv.includes('--production')
|
|
const watch = process.argv.includes('--watch')
|
|
|
|
/** @type {import('esbuild').BuildOptions} */
|
|
const options = {
|
|
entryPoints: ['src/extension.ts'],
|
|
bundle: true,
|
|
outfile: 'dist/index.cjs',
|
|
external: ['vscode'],
|
|
format: 'cjs',
|
|
platform: 'node',
|
|
target: 'node20',
|
|
sourcemap: !production,
|
|
minify: production,
|
|
logLevel: 'info',
|
|
}
|
|
|
|
if (watch) {
|
|
const ctx = await esbuild.context(options)
|
|
await ctx.watch()
|
|
console.log('[esbuild] watching...')
|
|
}
|
|
else {
|
|
await esbuild.build(options)
|
|
}
|