[wp-trac] [WordPress Trac] #43733: Replace Underscores.js with Lodash.js

WordPress Trac noreply at wordpress.org
Thu Apr 23 03:59:47 UTC 2020


#43733: Replace Underscores.js with Lodash.js
--------------------------------------+------------------------------
 Reporter:  ChopinBach                |       Owner:  adamsilverstein
     Type:  task (blessed)            |      Status:  assigned
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  External Libraries        |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  dev-feedback needs-patch  |     Focuses:  javascript
--------------------------------------+------------------------------

Comment (by adamsilverstein):

 I spent a little time looking at core use of 'underscore' and found the
 following dependencies:

 ==== The following core scripts depend on 'underscore':
  * 'color-scheme-control'
  * 'backbone'
  * 'wp-util'
  * 'code-editor'
  * 'wp-theme-plugin-editor'
  * 'customize-base'
  * 'customize-models'
  * 'customize-views'
  * 'shortcode'
  * 'wp-api'
  * 'post'
  * 'editor-expand'
  * 'nav-menu'

 ====  'backbone' is depended on by:
  * 'wp-backbone'
  * 'wp-playlist'
  * 'customize-models'
  * 'ap-api'
  * 'text-widgets'
  * 'custom-html-widgets'

 ==== 'wp-backbone' is depended on by:
  * 'revisions'
  * 'customize-widgets'
  * 'customize-nav-menus'
  * 'media-models'
  * 'theme'

 >  What comes to mind for me is reducing the chances that both Lodash and
 Underscore would be loaded on the same page in a default installation of
 WordPress. For example, it can be seen on the post editor screen that both
 are loaded (noted in comment above).

 I would agree, fixing the duplicate script load on the editor screen is a
 high priority, so it makes sense to tackle the use by `media-modals`
 first. According to this document:
 https://github.com/lodash/lodash/wiki/Migrating#backbone Backbone should
 work fine with Lodash. I'm going to test by creating a `lodash-wp-
 backbone` and having media-models depend on that.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43733#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list