Skip to content

Switch to esbuild's native watcher for building extensions#312283

Merged
mjbvz merged 4 commits intomicrosoft:mainfrom
mjbvz:dev/mjbvz/vague-dormouse
Apr 24, 2026
Merged

Switch to esbuild's native watcher for building extensions#312283
mjbvz merged 4 commits intomicrosoft:mainfrom
mjbvz:dev/mjbvz/vague-dormouse

Conversation

@mjbvz
Copy link
Copy Markdown
Collaborator

@mjbvz mjbvz commented Apr 24, 2026

This should be good to use now and also lets us benefit from incremental builds. In my testing the memory and cpu usage seems reasonable but will keep an eye on this

This should be good to use now and also lets use benefit from incremental builds

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 24, 2026 01:43
@mjbvz mjbvz added this to the 1.118.0 milestone Apr 24, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Switches the extension/webview esbuild build scripts from @parcel/watcher-driven rebuilds to esbuild’s native context(...).watch() to enable incremental builds and simplify watch mode.

Changes:

  • Move default webview esbuild options into run() and make build() directly call esbuild.build(options).
  • Replace @parcel/watcher-based --watch implementation with esbuild.context(...).watch() in both common scripts.
  • Replace tryBuild error-swallowing flow with an esbuild plugin that invokes didBuild on build end.
Show a summary per file
File Description
extensions/esbuild-webview-common.mts Uses esbuild’s native watch mode for webview builds and wires didBuild via an onEnd plugin.
extensions/esbuild-extension-common.mts Uses esbuild’s native watch mode for extension builds and wires didBuild via an onEnd plugin.

Copilot's findings

Comments suppressed due to low confidence (2)

extensions/esbuild-webview-common.mts:67

  • Switching to ctx.watch() means rebuilds (and therefore didBuild) will only run when esbuild detects an input/dependency change. If callers use didBuild to copy non-imported assets from config.srcDir (e.g. shell scripts, JSON, etc.), edits to those files will no longer trigger the post-build step. Consider adding a lightweight directory watcher for config.srcDir (or documenting the limitation) so non-bundled files still get picked up during --watch.
		const ctx = await esbuild.context(resolvedOptions);
		await ctx.watch();

extensions/esbuild-extension-common.mts:87

  • Switching to ctx.watch() means rebuilds (and therefore didBuild) will only run when esbuild detects an input/dependency change. Some callers use didBuild to copy non-imported assets from config.srcDir (e.g. extensions/git copies *.sh files); edits to those files will no longer trigger during --watch. Consider adding a directory watcher for config.srcDir (or otherwise triggering didBuild/ctx.rebuild() on non-bundled file changes).
		const ctx = await esbuild.context(resolvedOptions);
		await ctx.watch();
  • Files reviewed: 2/2 changed files
  • Comments generated: 4

Comment thread extensions/esbuild-webview-common.mts Outdated
Comment thread extensions/esbuild-extension-common.mts Outdated
Comment thread extensions/esbuild-extension-common.mts Outdated
Comment thread extensions/esbuild-webview-common.mts Outdated
mjbvz and others added 3 commits April 23, 2026 19:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
@mjbvz mjbvz merged commit 452b59f into microsoft:main Apr 24, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants