[wp-trac] [WordPress Trac] #62709: Script modules integration with wp_resource_hints

WordPress Trac noreply at wordpress.org
Wed Dec 18 11:16:00 UTC 2024


#62709: Script modules integration with wp_resource_hints
-------------------------------------+-----------------------------
 Reporter:  jonsurrell               |      Owner:  (none)
     Type:  enhancement              |     Status:  new
 Priority:  normal                   |  Milestone:  Awaiting Review
Component:  Script Loader            |    Version:  6.5
 Severity:  normal                   |   Keywords:
  Focuses:  javascript, performance  |
-------------------------------------+-----------------------------
 [https://developer.wordpress.org/reference/functions/wp_dependencies_unique_hosts/
 The wp_dependencies_unique_hosts() function] returns a list of all the
 unique hosts that appear in script and style dependencies.

 [https://developer.wordpress.org/reference/functions/wp_resource_hints/
 That data is used by the wp_resource_hints() function] to print DNS `<link
 rel="dns-prefetch" href="{{ HOST_NAME }}">` tags, a performance hint used
 by browsers.

 `wp_dependencies_unique_hosts` does not inspect script modules at all. The
 result is that performance hints are not printed for script modules.

 Script modules do handle some of their own performance hints, in
 particular [https://developer.mozilla.org/en-
 US/docs/Web/HTML/Attributes/rel/modulepreload rel=modulepreload] link tags
 are
 [https://developer.wordpress.org/reference/classes/wp_script_modules/print_script_module_preloads/
 printed via WP_Script_Modules::print_script_module_preloads()], but script
 modules miss out on this broader handling of dependencies via
 `wp_resource_hints` for dns-prefetch.

 This is likely blocked on #60597, it requires exposing information about
 script modules for inspection.

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


More information about the wp-trac mailing list