Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 939 Bytes

File metadata and controls

38 lines (28 loc) · 939 Bytes

True End Plugin

A custom hook for the true end of a build, cross bundlers.

Hooks

asyncTrueEnd

This hook is called at the very end of the build asynchronously.

It may execute sooner than syncTrueEnd in some contexts:

  • esbuild will call asyncTrueEnd before syncTrueEnd.
    • We use build.onDispose, for the latest hook possible in the build. The issue is, it's synchronous only. So we have to use build.onEnd for the asynchronous asyncTrueEnd, but it's called well before build.onDispose.
{
    name: 'my-plugin',
    async asyncTrueEnd() {
        // Do something asynchronous on closure
        await someAsyncOperation();
    }
}

syncTrueEnd

This hook is called at the very end of the build synchronously.

{
    name: 'my-plugin',
    syncTrueEnd() {
        // Do something synchronous on closure
        someSyncOperation();
    }
}