-
Notifications
You must be signed in to change notification settings - Fork 43
/
build.mjs
37 lines (34 loc) · 832 Bytes
/
build.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import esbuild from 'esbuild'
import * as process from "node:process";
import * as console from "node:console";
const production = process.argv.includes("--production")
const watch = process.argv.includes("--watch")
/** @type {esbuild.BuildOptions} */
const options = {
entryPoints: ["./src/extension.ts"],
bundle: true,
outdir: "out",
external: ["vscode"],
format: "cjs",
sourcemap: !production,
minify: production,
platform: "node",
logLevel: 'info',
// needed for debugger
keepNames: true,
// needed for vscode-* deps
mainFields: ['module', 'main']
};
(async function () {
try {
if (watch) {
const ctx = await esbuild.context(options)
await ctx.watch()
} else {
await esbuild.build(options);
}
} catch (error) {
console.error(error)
process.exit(1)
}
})()