Problem
DrupalLibraryElementGenerator::generate() turns a render array's attached libraries into elements. It resolves the dependencies itself but atm ignores weight. Next, it ships drupal-settings of the render-tree, but does not add settings provided via hook_js_settings_build().
This leads to issues when e.g. drupal/ajax library shall be loaded but its settings are missing.
Steps to reproduce
1. Any custom-elements route whose render array attaches core/drupal.dialog.ajax (a form with an AJAX dialog is enough).
2. Render the payload's drupal-library-* elements with the frontend loader (nuxtjs-drupal-ce loadLibrary() / lupus-nuxt3-kickstart's drupal-library--default.vue).
3. Console: the errors above; Drupal.ajax(...) throws on drupalSettings.ajaxTrustedUrl.
Proposed resolution
Run the AssetResolver::getJsAssets() pipeline on the resulting libraries.
Note: I created the issue with help of AI.
Issue fork custom_elements-3625091
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
fagoMR attached! Note: I created the MR with help of AI.
Comment #3
fagohere is the MR: https://git.drupalcode.org/project/custom_elements/-/merge_requests/202
Comment #4
fagoI ran regression tests on this and found one difference. drupal-library-locale-translations vanishes on webform routes.
Explained by the AI agent like this:
Proposed fix emit an element for every resolved library even without files.