[wp-trac] [WordPress Trac] #55030: wp_enqueue_script( 'jquery-ui-autocomplete' ) - is enqueueing a bunch of extra scripts I don't need

WordPress Trac noreply at wordpress.org
Thu Feb 17 15:24:44 UTC 2022


#55030: wp_enqueue_script( 'jquery-ui-autocomplete' ) - is enqueueing a bunch of
extra scripts I don't need
---------------------------+------------------------------
 Reporter:  wpfed          |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Script Loader  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  javascript
---------------------------+------------------------------

Comment (by wpfed):

 I discovered that two of the extra scripts are coming from contact form 7,
 it adds dependency for wp-polyfill which has a dependency on regenerator.

 wp-includes/js/dist/vendor/wp-polyfill.min.js
 wp-includes/js/dist/vendor/regenerator-runtime.min.js

 Looks like the core adds extra dependencies as well:
 {{{
 $scripts->add( 'jquery-ui-autocomplete', "/wp-
 includes/js/jquery/ui/autocomplete$suffix.js", array( 'jquery-ui-menu',
 'wp-a11y' ), '1.12.1', 1 );
 }}}

 Looks like best practice is to not use WP packages as they add many
 unnecessary scripts. Unfortunately plugin authors use them sometimes which
 is going to slow down many sites.

 This can be closed.

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


More information about the wp-trac mailing list