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
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:
- spineless_
changes, plain diff MR !17162
- spineless
changes, plain diff MR !17161
- 3623843-spineless---remove
compare
Comments
Comment #5
nicxvan commentedspineless removes backbone.
spineless_ removes backbone and underscore.
Comment #6
nicxvan commentedComment #7
nicxvan commentedComment #9
nicxvan commentedComment #10
nicxvan commentedI 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.
yarn remove backbonecore.libraries.ymlentryCOPYRIGHT.txtentrycore/scripts/js/vendor-update.jsentrycore/assets/vendor/backbonedirectoryI 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.mjswhich did not have an underscore reference.Comment #11
quietone commentedThe 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.
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.
Comment #12
nicxvan commentedThanks! I think we should let @catch do the honors. I'll reroll if we need to.
Comment #13
gábor hojtsyMore complete title. Sorry for less puns.
Comment #14
gábor hojtsyAdded release notes snippet and slightly expanded the reasoning to be more complete.
Comment #15
gábor hojtsyComment #16
quietone commentedThe pun was fun while it lasted :-)
Comment #17
quietone commentedComment #19
catchCommitted/pushed to main, thanks! This took such a long time but we finally got there.
Comment #21
quietone commentedComment #22
quietone commented