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

WordPress Trac noreply at wordpress.org
Thu Feb 22 14:15:47 UTC 2024


#56313: Add the ability to handle ES Modules and Import Maps
-------------------------------------+-------------------------------------
 Reporter:  idad5                    |       Owner:  luisherranz
     Type:  enhancement              |      Status:  closed
 Priority:  normal                   |   Milestone:  6.5
Component:  Script Loader            |     Version:
 Severity:  normal                   |  Resolution:  fixed
 Keywords:  has-patch has-unit-      |     Focuses:  javascript,
  tests needs-dev-note               |  performance
-------------------------------------+-------------------------------------

Comment (by cbravobernal):

 Replying to [comment:80 azaozz]:

 > Imho this name is descriptive, sounds good, and seems consistent.
 Replacing `deregister` with `remove` would also work (imho both are quite
 good).

 I created a small PR to change that: https://github.com/WordPress
 /wordpress-develop/pull/6160

 > Agree that the current `$id` params may be a bit ambiguous. They were
 renamed in [57327] from `$module_id`. If they are renamed again, I'd
 suggest using the old name: `$module_id` as that seems better than
 `$handle` imho. Another possibility would be `$script_module_id` which is
 long but best describes what they are and how they are used.

 If we consider $id more descriptive than $handler, imho, adding the
 `script_module` may not be necessary, as those functions are already
 inside a script-modules folder. (Although it is true that is not the best
 for search indexes).

 But, while changing that, we could mess up with the dependencies array,
 which all of them are currently using 'id' key as reference.

 {{{#!php
 <?php
 // src/wp-includes/class-wp-script-modules.phpL73
 $dependencies[] = array(
   'id'     => $dependency ['id'] ,
   'import' => isset( $dependency['import'] ) && 'dynamic' ===
 $dependency['import'] ? 'dynamic' : 'static',
 );
 }}}

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


More information about the wp-trac mailing list