[wp-trac] [WordPress Trac] #45187: Dependencies from NPM packages do not have version passed when registered

WordPress Trac noreply at wordpress.org
Thu Oct 25 13:43:03 UTC 2018


#45187: Dependencies from NPM packages do not have version passed when registered
---------------------------+-----------------------------
 Reporter:  dimadin        |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Script Loader  |    Version:  5.0
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 For WordPress 5.0, new scripts and styles were added in #45065 that are
 developed externally and distributed through NPM packages. They are either
 developed through Gutenberg project, or fully independent from WordPress
 (registered in `wp_default_packages_vendor()` function).

 In all cases, when those dependencies are registered to be used in
 WordPress, versions of their respective packages are not passed.

 There are two ways to solve this. Either by switching to associative
 arrays so that instead of

 {{{#!php
 'react-dom' => array( 'react' ),
 }}}

 we have

 {{{#!php
 'react-dom' => array(
         'dependencies' => array( 'react' ),
         'version'      => '16.5.2',
 ),
 }}}

 or by ditching arrays and using approach already used in
 `wp_default_scripts()` and `wp_default_styles()`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45187>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list