| 43 | }; |
| 44 | |
| 45 | async function main() { |
| 46 | const ctx = await esbuild.context({ |
| 47 | entryPoints: [ |
| 48 | 'src/main.ts' |
| 49 | ], |
| 50 | bundle: true, |
| 51 | format: 'cjs', |
| 52 | minify: production, |
| 53 | sourcemap: !production, |
| 54 | sourcesContent: false, |
| 55 | platform: 'node', |
| 56 | outfile: 'dist/extension.js', |
| 57 | external: ['vscode', 'applicationinsights-native-metrics', '@opentelemetry/tracing'], |
| 58 | logLevel: 'info', |
| 59 | plugins: [ |
| 60 | umdEsmLoaderPlugin, |
| 61 | /* add to the end of plugins array */ |
| 62 | esbuildProblemMatcherPlugin, |
| 63 | ], |
| 64 | }); |
| 65 | if (watch) { |
| 66 | await ctx.watch(); |
| 67 | } else { |
| 68 | await ctx.rebuild(); |
| 69 | await ctx.dispose(); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | main().catch(e => { |
| 74 | console.error(e); |