23 lines
492 B
JavaScript
23 lines
492 B
JavaScript
import * as esbuild from 'esbuild'
|
|||
|
|
|
||
|
|
const watch = process.argv.includes('--watch')
|
||
|
|
const options = {
|
||
|
|
entryPoints: ['src/extension.ts'],
|
||
|
|
bundle: true,
|
||
|
|
outfile: 'dist/extension.js',
|
||
|
|
external: ['vscode'],
|
||
|
|
format: 'cjs',
|
||
|
|
platform: 'node',
|
||
|
|
target: 'node20',
|
||
|
|
sourcemap: true,
|
||
|
|
logLevel: 'info',
|
||
|
|
}
|
||
|
|
|
||
|
|
if (watch) {
|
||
|
|
const context = await esbuild.context(options)
|
||
|
|
await context.watch()
|
||
|
|
console.log('Watching VS Code extension sources...')
|
||
|
|
} else {
|
||
|
|
await esbuild.build(options)
|
||
|
|
}
|