Problem/Motivation

Toolbar was the last usage of Backbone in core. Underscore.js is only in core as a dependency of Backbone. Both are internal APIs. Drupal 10 had this in the release notes (via @quietone):

The public Backbone and Underscore core libraries have been removed. These dependencies are now deprecated and for internal use only. Consequently, the drupal.editor.admin and drupal.filter.filter_html.admin libraries no longer depend on Underscore. Backbone and Underscore will eventually be removed from core.

Modules or themes that depend on these libraries should either refactor their code to remove the dependencies, or treat them as third-party dependencies for the contributed module.

Steps to reproduce

N/A

Proposed resolution

Remove them.

Remaining tasks

Commit.

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

The internally used Backbone and Underscore third party JavaScript libraries have been removed. They were not part of the core API since Drupal 10.

Issue fork drupal-3623843

Command icon 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

nicxvan created an issue. See original summary.

nicxvan changed the visibility of the branch 3623843-spineless---remove to hidden.

nicxvan’s picture

spineless removes backbone.
spineless_ removes backbone and underscore.

nicxvan’s picture

Status: Active » Needs review
nicxvan’s picture

Issue summary: View changes

nicxvan changed the visibility of the branch spineless to hidden.

nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes

I couldn't find any documentation on how to remove dependencies so here is what I did:

I used nvm to install the current version of node that core uses. (24)
Then I used https://www.drupal.org/about/core/policies/core-dependency-policies-and-... to get the right version of yarn.

  • I searched for backbone in the project to see if anything used it.
  • I explicitly searched for the library entry to see if there were dependencies
  • Then I ran yarn remove backbone
  • Next I deleted the core.libraries.yml entry
  • Next I deleted the COPYRIGHT.txt entry
  • Next I deleted the core/scripts/js/vendor-update.js entry
  • Finally I deleted the core/assets/vendor/backbone directory

I did the same for underscore, but there are far, far more references to the word underscore than backbone so it wasn't as productive.
The edits ended up being the same with the exclusion of core/eslint.config.mjs which did not have an underscore reference.

quietone’s picture

Status: Needs review » Reviewed & tested by the community

The changes to package.json match what I get when I 'yarn remove backbone'

On main backbone is in 9 files and after applying the diff all references are removed. Can't do the same with the word underscore though.

(main) $ git grep -li backbone | wc -l
9

And there are no files remaining with backbone or underscore in the name. Except when underscore means the character

On a personal note, I am glad to see less in the COPYRIGHT file. It can be unpleasant to update.

nicxvan’s picture

Thanks! I think we should let @catch do the honors. I'll reroll if we need to.

gábor hojtsy’s picture

Title: Spineless - Remove Backbone.js » Remove Backbone.js and Underscore.js, not used in core anymore

More complete title. Sorry for less puns.

gábor hojtsy’s picture

Issue summary: View changes

Added release notes snippet and slightly expanded the reasoning to be more complete.

gábor hojtsy’s picture

Issue summary: View changes
quietone’s picture

The pun was fun while it lasted :-)

quietone’s picture

Issue tags: +12.0.0 beta blocker

  • catch committed 5b6a1827 on main
    task: #3623843 Remove Backbone.js and Underscore.js, not used in core...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to main, thanks! This took such a long time but we finally got there.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

quietone’s picture

quietone’s picture

Issue tags: +12.0.0 release notes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.