[wp-trac] [WordPress Trac] #61734: Add the ability to handle "fetchpriority" to ES Modules and Import Maps

WordPress Trac noreply at wordpress.org
Wed Sep 3 22:15:48 UTC 2025


#61734: Add the ability to handle "fetchpriority" to ES Modules and Import Maps
-------------------------------------+-------------------------------------
 Reporter:  dennysdionigi            |       Owner:  westonruter
     Type:  enhancement              |      Status:  closed
 Priority:  normal                   |   Milestone:  6.9
Component:  Script Loader            |     Version:  6.5
 Severity:  minor                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-      |     Focuses:  javascript,
  tests                              |  performance
-------------------------------------+-------------------------------------
Changes (by westonruter):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"60704" 60704]:
 {{{
 #!CommitTicketReference repository="" revision="60704"
 Script Loader: Introduce `fetchpriority` for Scripts and Script Modules.

 * Allow scripts and script modules to be registered with a `fetchpriority`
 of `auto` (default), `high`, `low`:
   * When registering a script, add a `fetchpriority` arg to go alongside
 the `strategy` arg which was added for loading scripts with the `defer`
 and `async` loading strategies. See #12009.
   * For script modules, introduce an `$args` array parameter with a
 `fetchpriority` key to the `wp_register_script_module()`, and
 `wp_enqueue_script_module()` functions (and their respective underlying
 `WP_Script_Modules::register()` and `WP_Script_Modules::enqueue()`
 methods). This `$args` parameter corresponds with the same parameter used
 when registering non-module scripts.
   * Also for script modules, introduce
 `WP_Script_Modules::set_fetchpriority()` to override the `fetchpriority`
 for what was previously registered.
   * Emit a `_doing_it_wrong()` warning when an invalid `fetchpriority`
 value is used, and when `fetchpriority` is added to a script alias.
   * Include `fetchpriority` as an attribute on printed `SCRIPT` tags as
 well as on preload `LINK` tags for static script module dependencies.
 * Use a `fetchpriority` of `low` by default for:
   * Script modules used with the Interactivity API. For overriding this
 default in blocks, see
 [https://github.com/WordPress/gutenberg/issues/71366 Gutenberg#71366].
   * The `comment-reply` script.
 * Improve type checks and type hints.

 Developed in [https://github.com/WordPress/wordpress-develop/pull/8815
 GitHub PR], with [https://github.com/WordPress/gutenberg/pull/70173
 companion for Gutenberg].

 Props westonruter, jonsurrell, swissspidy, luisherranz, kraftbj, audrasjb,
 dennysdionigi.
 Fixes #61734.
 }}}

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


More information about the wp-trac mailing list