refactor: remove ESBuildContextManager from app-event-watcher#7252
refactor: remove ESBuildContextManager from app-event-watcher#7252isaacroldan wants to merge 1 commit intomainfrom
Conversation
1c759aa to
514b959
Compare
There was a problem hiding this comment.
Pull request overview
Removes the custom esbuild-context-based build path from the app dev watcher so UI extensions go through the same “standard” build pipeline (and therefore run the same build steps) as other extension types.
Changes:
- Deleted
ESBuildContextManagerand its dedicated tests. - Simplified
AppEventWatcherto always build extensions viaextension.buildForBundle(). - Updated watcher tests to no longer mock/inject the esbuild manager and to simulate errors via the standard build path.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/app/src/cli/services/dev/app-events/app-watcher-esbuild.ts | Removed the custom esbuild context manager implementation. |
| packages/app/src/cli/services/dev/app-events/app-watcher-esbuild.test.ts | Removed tests tied to the esbuild context manager behavior. |
| packages/app/src/cli/services/dev/app-events/app-event-watcher.ts | Dropped the esbuild-manager branch and unified extension builds under buildForBundle(). |
| packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts | Updated tests to match the unified build path; removed esbuild-manager mocking. |
Comments suppressed due to low confidence (5)
packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts:404
- There’s trailing whitespace on this blank line, which will likely fail formatting/linting (Prettier/no-trailing-spaces). Please remove the spaces so it’s an empty line.
if (needsAppReload) {
packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts:441
- There’s trailing whitespace on this blank line, which will likely fail formatting/linting (Prettier/no-trailing-spaces). Please remove the spaces so it’s an empty line.
// Then
packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts:478
- There’s trailing whitespace on this blank line, which will likely fail formatting/linting (Prettier/no-trailing-spaces). Please remove the spaces so it’s an empty line.
})
packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts:512
- There’s trailing whitespace on this blank line, which will likely fail formatting/linting (Prettier/no-trailing-spaces). Please remove the spaces so it’s an empty line.
})
packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts:603
- There’s trailing whitespace on this blank line, which will likely fail formatting/linting (Prettier/no-trailing-spaces). Please remove the spaces so it’s an empty line.
type: 'file_updated',
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return useConcurrentOutputContext({outputPrefix: ext.handle, stripAnsi: false}, async () => { | ||
| try { | ||
| if (this.esbuildManager.contexts?.[ext.uid]?.length) { | ||
| await this.esbuildManager.rebuildContext(ext) | ||
| const sizeInfo = await formatBundleSize(ext.outputPath) | ||
| this.options.stdout.write(`Build successful${sizeInfo}`) | ||
| } else { | ||
| await this.buildExtension(ext) | ||
| } | ||
| await this.buildExtension(ext) | ||
| // Update all events for this extension with success result |
There was a problem hiding this comment.
With the ESBuildContextManager path removed, UI extensions now build via extension.buildForBundle(). The UI bundling step (buildUIExtension) currently catches esbuild failures and rethrows an AbortError without preserving the original error.errors payload, so this watcher’s esbuild-specific formatting branch won’t run and users may only see a generic message. Consider propagating the underlying esbuild errors array on the thrown error (similar to buildFunctionExtension) so dev watcher output remains actionable.
acf912a to
d158b9f
Compare
Co-authored-by: Claude Code <claude-code@anthropic.com>
d158b9f to
21d8851
Compare

We originally added
ESBuildContextManageras a faster way to re-build UI extensions -> by keeping in memory esbuild contexts, re-builds are faster.This was at the expense of having a custom build pipeline in the app watcher just for ui extensions. This is now causing issues because ui-extensions are not following the standard build flow and therefore not running all "build steps".
This PR removes
ESBuildContextManagerand brings back ui-extensions to be compiled like the rest of extensions:The benefit of this manager is negligible for small extensions (we might save single digit miliseconds)