Problem/Motivation

I've had to remove certain libraries from the front end as they error out because of require.js (which has been a total nightmare that we're trying to move away from). I used libraries-override to remove core/tabbable (from core.libraries.yml) because it was throwing errors.

Got some errors today because tabble.jquery.shim (also core.libraries.yml) is being loaded, which depends on tabbable.

Library config for tabbable.jquery.shim from core.libaries.yml:

tabbable.jquery.shim:
  version: VERSION
  js:
    misc/jquery.tabbable.shim.js: {}
  dependencies:
    - core/drupal
    - core/tabbable
    - core/jquery

Seems like if a dependency of a library is removed that the library should not be loaded, and ideally a warning is logged.

Steps to reproduce

In a theme, add:

libraries-override:
  core/tabbable: false

Then add under libraries:

libararies:
  core/tabbable.jquery.shim

This will load tabbable.jquery.shim even though core/tabbable is a dep that has been removed.

Proposed resolution

If a library is removed, any library depending on it should not be loaded.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

wesruv created an issue. See original summary.

wesruv’s picture

Issue summary: View changes
wesruv’s picture

Issue summary: View changes
wesruv’s picture

I marked this 9.3.x-dev because that's the version we're on, not sure what I should mark?

cilefen’s picture

Version: 9.3.x-dev » 9.4.x-dev
Issue tags: -Libraries, -dependencies
nod_’s picture

If I followed the example, what you expect to happen is that core/tabbable.jquery.shim is NOT loaded at all because the core/tabbable library was removed. Is that correct?

wesruv’s picture

Correct!

nod_’s picture

Issue summary: View changes

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.