26 lines
628 B
JavaScript
26 lines
628 B
JavaScript
import * as esbuild from "esbuild";
|
|
|
|
const watch = process.argv.includes("--watch");
|
|
|
|
/** @type {import("esbuild").BuildOptions} */
|
|
const options = {
|
|
entryPoints: ["src/extension.ts"],
|
|
bundle: true,
|
|
platform: "node",
|
|
format: "cjs",
|
|
target: "node18",
|
|
outfile: "dist/extension.js",
|
|
external: ["vscode"], // always external — provided by the extension host
|
|
sourcemap: true,
|
|
logLevel: "info",
|
|
};
|
|
|
|
if (watch) {
|
|
const ctx = await esbuild.context(options);
|
|
await ctx.watch();
|
|
console.log("esbuild watching for changes...");
|
|
} else {
|
|
await esbuild.build(options);
|
|
console.log("esbuild build complete.");
|
|
}
|