| 123456789101112131415161718192021222324252627282930313233 |
- const esbuild = require('esbuild');
- const production = process.argv.includes('--minify');
- const watch = process.argv.includes('--watch');
- /** @type {esbuild.BuildOptions} */
- const config = {
- entryPoints: ['src/extension.ts'],
- bundle: true,
- outfile: 'dist/extension.js',
- external: ['vscode'],
- format: 'cjs',
- platform: 'node',
- sourcemap: !production,
- minify: production,
- treeShaking: true,
- };
- async function main() {
- if (watch) {
- const ctx = await esbuild.context(config);
- await ctx.watch();
- console.log('[esbuild] watching for changes...');
- } else {
- await esbuild.build(config);
- console.log('[esbuild] build complete');
- }
- }
- main().catch((e) => {
- console.error(e);
- process.exit(1);
- });
|