Uninstall hook for extensions

Hi there,

Is there any way to cleanup things from an extension?
For example my extension creates fields, puts somethings into the globalThis.
It would be nice to have some hook to remove all of that if the user wants that.

There currently is no “uninstall event” that could be used to clean up. Implementing this reliably could be tricky as the act of “uninstalling” could simply be: deleting the folder from disk.

There is an open feature requests that attempts to address this: Add extension events to hooks · directus/directus · Discussion #20306 · GitHub