Skip to content

Commit

Permalink
chore: clean up build file
Browse files Browse the repository at this point in the history
  • Loading branch information
fcasal committed Sep 20, 2024
1 parent ed4722c commit 4c9a450
Showing 1 changed file with 6 additions and 47 deletions.
53 changes: 6 additions & 47 deletions esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,12 @@ const extensionConfig = {
platform: "node",
mainFields: ["module", "main"],
format: "cjs",
loader: {
".html": "text",
},
loader: { ".html": "text" },
entryPoints: ["./src/extension.ts"],
outfile: "./out/extension.js",
external: ["vscode"],
};

(async () => {
try {
await build(extensionConfig);
console.log("build complete");
} catch (err) {
process.stderr.write(err.stderr);
process.exit(1);
}
})();

const watchConfig = {
watch: {
onRebuild(error, result) {
Expand All @@ -44,28 +32,6 @@ const watchConfig = {
},
};

(async () => {
const args = process.argv.slice(2);
try {
if (args.includes("--watch")) {
// Build and watch source code
console.log("[watch] build started");
await build({
...extensionConfig,
...watchConfig,
});
console.log("[watch] build finished");
} else {
// Build source code
await build(extensionConfig);
console.log("build complete");
}
} catch (err) {
process.stderr.write(err.stderr);
process.exit(1);
}
})();

const webviewConfig = {
...baseConfig,
target: "es2020",
Expand All @@ -88,18 +54,11 @@ const gitConfigWebviewConfig = {
if (args.includes("--watch")) {
// Build and watch extension and webview code
console.log("[watch] build started");
await build({
...extensionConfig,
...watchConfig,
});
await build({
...webviewConfig,
...watchConfig,
});
await build({
...gitConfigWebviewConfig,
...watchConfig,
});

await build({ ...extensionConfig, ...watchConfig });
await build({ ...webviewConfig, ...watchConfig });
await build({ ...gitConfigWebviewConfig, ...watchConfig });

console.log("[watch] build finished");
} else {
// Build extension and webview code
Expand Down

0 comments on commit 4c9a450

Please sign in to comment.