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

WordPress Trac noreply at wordpress.org
Tue Jan 9 18:54:29 UTC 2024


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

Comment (by jorbin):

 Replying to [comment:17 luisherranz]:

 > > You mention not having registration and enqueuing together but don't
 include any rationale behind why extenders of WordPress should need to
 maintain two different mental models for how external files are loaded
 into the HTML.
 >
 > This was suggested to me as an improvement over the Scripts API in the
 past. I don't remember who was at this moment, but I'll ask to see if that
 person can provide additional rationale.
 >
 > To me, it made sense to separate both registration and enqueuing as a
 way to teach people that those are two separate steps, especially when
 working with modules where registered modules can't only end up being
 enqueued, but also preloaded or added to the import map.
 >

 Forcing people to keep two different mental models in their head for how
 to interact with scripts on a page creates an unnecessary burden on the
 extenders of WordPress.

 Why does it need to be two separate steps when it's not anywhere else in
 WordPress? Enqueuing a module should automatically register it just as
 enqueuing a script or a style does.

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


More information about the wp-trac mailing list