mirror of
https://github.com/jasonwilliams/vscode-helix.git
synced 2024-10-06 21:27:59 +03:00
41 lines
843 B
JavaScript
41 lines
843 B
JavaScript
const production = process.argv[2] === '--production';
|
|
import esbuild from 'esbuild';
|
|
|
|
const watch = process.argv[2] === '--watch';
|
|
const context = await esbuild
|
|
.context({
|
|
entryPoints: ['./src/index.ts'],
|
|
bundle: true,
|
|
outdir: 'dist',
|
|
external: ['vscode'],
|
|
format: 'cjs',
|
|
sourcemap: !production,
|
|
minify: production,
|
|
platform: 'node',
|
|
target: 'ES2022',
|
|
plugins: [
|
|
{
|
|
name: 'watch',
|
|
setup(build) {
|
|
build.onEnd(() => {
|
|
if (watch) console.log('build finished');
|
|
});
|
|
build.onStart(() => {
|
|
if (watch) console.log('building');
|
|
});
|
|
},
|
|
},
|
|
],
|
|
})
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|
|
|
|
if (watch) {
|
|
await context.watch();
|
|
} else {
|
|
context.rebuild();
|
|
context.dispose();
|
|
}
|