evanw / evanw/esbuild

Promise onDispose callback

Open
#4,356 1 comment 0 reactions 0 assignees View on GitHub
breaking
Dominant language
Go
Stars
40.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Hi! I had a small naive question,

Since `ctx.dispose()` is a Promise, would it be possible to allow ESbuild to wait for plugins as well when disposing? The possibility to add promises to the [dispose callback array](https://github.com/evanw/esbuild/blob/5e0e56d6d62076dfeff47f5227ae5300f91d2b16/lib/shared/common.ts#L1328C1-L1330C11) would allow developers to await for all plugins to be cleaned up until proceeding.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in lib/shared/common.ts at the dispose callback array linked in the issue, then trace how ctx.dispose() processes those callbacks. Determine the API and lifecycle changes needed for promise-returning plugin cleanup, and verify that ctx.dispose() waits for all registered cleanup before resolving.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.