Skip to content

fix: use dynamic import for useBus to support volume-mounted extensions#97

Open
alphanull wants to merge 1 commit intobcc-code:mainfrom
alphanull:feat/dynamic-useBus
Open

fix: use dynamic import for useBus to support volume-mounted extensions#97
alphanull wants to merge 1 commit intobcc-code:mainfrom
alphanull:feat/dynamic-useBus

Conversation

@alphanull
Copy link
Copy Markdown

The static import of useBus from @directus/api requires the extension to be bundled into the Directus Docker image. By switching to a dynamic import wrapped in try/catch, the extension gracefully degrades when the internal API is unavailable (e.g. when loaded as a volume-mounted extension without a custom Dockerfile).

Flow reload after import still works when running inside the official Directus image; it is silently skipped otherwise.

This makes it possible to run this as a regular extension if automatic flow reload is not an issue.

The static import of useBus from @directus/api requires the extension
to be bundled into the Directus Docker image. By switching to a dynamic
import wrapped in try/catch, the extension gracefully degrades when the
internal API is unavailable (e.g. when loaded as a volume-mounted
extension without a custom Dockerfile).

Flow reload after import still works when running inside the official
Directus image; it is silently skipped otherwise.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant