Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#55030 new defect (bug)

wp_enqueue_script( 'jquery-ui-autocomplete' ) - is enqueueing a bunch of extra scripts I don't need

Reported by: wpfed's profile wpfed Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Script Loader Keywords:
Focuses: javascript Cc:


When I enqueue default scripts located in WP, specifically

wp_enqueue_script( 'jquery-ui-autocomplete' )

All of these extra scripts are also loaded on the front-end:


I was using this reference:

Is this normal behavior?

Change History (3)

#1 @peterwilsoncc
2 years ago

  • Component changed from General to Script Loader
  • Focuses javascript added

#2 @wpfed
2 years ago

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.


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.

Note: See TracTickets for help on using tickets.