A custom hook for the true end of a build, cross bundlers.
This hook is called at the very end of the build asynchronously.
It may execute sooner than syncTrueEnd in some contexts:
esbuildwill callasyncTrueEndbeforesyncTrueEnd.- We use
build.onDispose, for the latest hook possible in the build. The issue is, it's synchronous only. So we have to usebuild.onEndfor the asynchronousasyncTrueEnd, but it's called well beforebuild.onDispose.
- We use
{
name: 'my-plugin',
async asyncTrueEnd() {
// Do something asynchronous on closure
await someAsyncOperation();
}
}This hook is called at the very end of the build synchronously.
{
name: 'my-plugin',
syncTrueEnd() {
// Do something synchronous on closure
someSyncOperation();
}
}