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

WordPress Trac noreply at wordpress.org
Thu Oct 23 18:29:27 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 needs-dev-note               |  performance
-------------------------------------+-------------------------------------

Comment (by westonruter):

 Replying to [comment:52 pbiron]:
 > I think there is a problem with the refactoring of
 [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-
 script-modules.php?rev=60999#L571 WP_Script_Modules::get_dependencies()]
 in [60999].

 @pbiron Thanks for that. I can indeed reproduce the issue with Query
 Monitor active when viewing a post that has lightbox enabled on an Image
 block. I get this error:

 {{{
 Uncaught TypeError: Cannot access offset of type string on string in
 /var/www/src/wp-content/plugins/query-
 monitor/classes/Collector_Assets.php:351
 Stack trace:
 #0 /var/www/src/wp-content/plugins/query-
 monitor/classes/Collector_Assets.php(89):
 QM_Collector_Assets::get_script_modules()
 #1 /var/www/src/wp-content/plugins/query-
 monitor/classes/Collectors.php(84): QM_Collector_Assets->process()
 #2 /var/www/src/wp-content/plugins/query-
 monitor/classes/Dispatcher.php(123): QM_Collectors->process()
 #3 /var/www/src/wp-content/plugins/query-
 monitor/dispatchers/Html.php(357):
 QM_Dispatcher->get_outputters('html')
 #4 /var/www/src/wp-content/plugins/query-
 monitor/dispatchers/Html.php(321): QM_Dispatcher_Html->before_output()
 #5 /var/www/src/wp-includes/class-wp-hook.php(332):
 QM_Dispatcher_Html->dispatch('')
 #6 /var/www/src/wp-includes/class-wp-hook.php(356):
 WP_Hook->apply_filters(NULL, Array)
 #7 /var/www/src/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
 #8 /var/www/src/wp-includes/load.php(1308): do_action('shutdown')
 #9 [internal function]: shutdown_action_hook()
 #10 {main}
   thrown in <b>/var/www/src/wp-content/plugins/query-
 monitor/classes/Collector_Assets.php</b> on line <b>351</b><br />
 }}}

 I was partially aware of the issue with Query Monitor because
 @peterwilsoncc found that it uses the private
 `WP_Script_Modules::get_marked_for_enqueue()` method. This private method
 wasn't being used anymore so I had removed it, but this caused QM to fail,
 so I restored it in [https://github.com/WordPress/wordpress-
 develop/pull/9867/commits/04ec8acc3905f8990d271b587e838c10d5276cdd
 04ec8ac] as part of PR [https://github.com/WordPress/wordpress-
 develop/pull/9867 #9867], but clearly I didn't look far enough.

 We should prioritize adding proper accessor methods to `WP_Script_Modules`
 to avoid the need to access the private internals. We did add one such
 method here in 6.9 and that is `WP_Script_Modules::get_queue()`. But there
 isn't a way to access the underlying registered data for a given script
 module without resorting to the Reflection API.

 cc @johnbillion

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


More information about the wp-trac mailing list