Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extension reloading for local bundle extensions #18287

Merged
merged 1 commit into from Apr 21, 2023

Conversation

nickrum
Copy link
Member

@nickrum nickrum commented Apr 21, 2023

Fixes #17694

@nickrum nickrum requested review from a team, paescuj, Nitwel and azrikahar and removed request for a team April 21, 2023 17:48
@paescuj
Copy link
Member

paescuj commented Apr 21, 2023

@nickrum I assume this is the preferred solution over #18278?

@rijkvanzanten rijkvanzanten merged commit b69f380 into main Apr 21, 2023
6 checks passed
@rijkvanzanten rijkvanzanten deleted the fix/local-bundle-reloading branch April 21, 2023 18:23
@paescuj
Copy link
Member

paescuj commented Apr 21, 2023

Nothing to worry about but do you think we can optimize the following points? Can create an issue in that case.

  • When rebuilding a bundle the reload info is always displayed twice:
    [20:34:09.262] INFO: Reloading extensions
    [20:34:34.583] INFO: Reloading extensions
    
  • When scaffolding or removing a bundle some warnings are displayed because the bundle is incomplete for some amount of time:
    [20:34:34.591] WARN: Couldn't register bundle "directus-extension-test"
    [20:34:34.591] WARN: Cannot find module '<redacted>/api/extensions/directus-extension-test/dist/api.cjs' imported from <redacted>/api/dist/extensions.js
    
  • Although the extension couldn't be registered it still appears in the list of loaded extensions:
    [11:38:58.565] INFO: Loaded extensions: directus-extension-test
    

@rijkvanzanten rijkvanzanten added this to the Next Release milestone Apr 24, 2023
@nickrum
Copy link
Member Author

nickrum commented May 3, 2023

When rebuilding a bundle the reload info is always displayed twice

This is due to the API watching both api.js as well as app.js for changes. We could debounce the reload, but that wouldn't help if one entrypoint takes way longer to be build than the other.

When scaffolding or removing a bundle some warnings are displayed because the bundle is incomplete for some amount of time

Hmm, that's not so nice, indeed! I wonder what we can do about it, though, unless we want to disable that warning as a whole 🤔

Although the extension couldn't be registered it still appears in the list of loaded extensions

That's more or less expected with the current system as loading an extension just means that it was found and registration of an extension means that the API imported it. We could tweak the wording or filter the list of loaded extensions based on if they were registered successfully.

meditadvisors pushed a commit to ciso360ai/directus-mod that referenced this pull request May 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

env EXTENSIONS_AUTO_RELOAD not working with bundle extensions
3 participants