Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GDG #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 37 additions & 35 deletions esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,47 @@ const webviewConfig = {
...baseConfig,
target: "es2020",
format: "esm",
entryPoints: ["./src/webview/webview.js"],
entryPoints: ["./src/webview/webview.jsx"],
outfile: "./out/webview.js",
};

const watchConfig = {
watch: {
onRebuild(error, result) {
console.log("[watch] build started");
if (error) {
error.errors.forEach(error =>
console.error(`> ${error.location.file}:${error.location.line}:${error.location.column}: error: ${error.text}`)
);
} else {
console.log("[watch] build finished");
}
},
},
};

(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,
...webviewConfig
});
console.log("[watch] build finished");
watch: {
onRebuild(error, result) {
console.log("[watch] build started");
if (error) {
error.errors.forEach((error) =>
console.error(
`> ${error.location.file}:${error.location.line}:${error.location.column}: error: ${error.text}`
)
);
} else {
// Build source code
await build(extensionConfig);
await build(webviewConfig);
console.log("build complete");
console.log("[watch] build finished");
}
} catch (err) {
process.stderr.write(err.stderr);
process.exit(1);
},
},
};

(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,
...webviewConfig,
});
console.log("[watch] build finished");
} else {
// Build source code
await build(extensionConfig);
await build(webviewConfig);
console.log("build complete");
}
})();
} catch (err) {
process.stderr.write(err.stderr);
process.exit(1);
}
})();
Loading