watch for build completion
This commit is contained in:
parent
f8d590d79b
commit
dcb9243656
1 changed files with 21 additions and 9 deletions
|
|
@ -22,13 +22,25 @@ const esbuildConfig = {
|
|||
supported: { "dynamic-import": false },
|
||||
};
|
||||
|
||||
const ENDS_PATTERN = "VS Code Extension esbuild complete"; // used verbatim in vscode tasks to detect completion
|
||||
(async () => {
|
||||
// Bundles the extension into one file
|
||||
if (flags.includes("--watch")) {
|
||||
const ctx = await esbuild.context(esbuildConfig);
|
||||
await ctx.watch();
|
||||
} else {
|
||||
await esbuild.build(esbuildConfig);
|
||||
}
|
||||
console.log("VS Code Extension esbuild complete"); // Used in task endpattern to signal completion
|
||||
})();
|
||||
// Bundles the extension into one file
|
||||
if (flags.includes("--watch")) {
|
||||
const ctx = await esbuild.context(esbuildConfig);
|
||||
await ctx.watch({
|
||||
onRebuild(error, result) {
|
||||
if (error) {
|
||||
console.error("Watch build failed:", error);
|
||||
throw error;
|
||||
} else {
|
||||
console.log(ENDS_PATTERN);
|
||||
}
|
||||
},
|
||||
});
|
||||
console.log("Esbuild: watching for changes...");
|
||||
} else {
|
||||
await esbuild.build(esbuildConfig);
|
||||
console.log(ENDS_PATTERN);
|
||||
}
|
||||
},
|
||||
)();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue