[wp-trac] [WordPress Trac] #60647: Script Modules: Allow modules to depend on existing WordPress scripts

WordPress Trac noreply at wordpress.org
Tue Mar 5 15:18:34 UTC 2024


#60647: Script Modules: Allow modules to depend on existing WordPress scripts
-----------------------------+------------------------------
 Reporter:  jonsurrell       |       Owner:  jonsurrell
     Type:  feature request  |      Status:  assigned
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Script Loader    |     Version:  trunk
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:  javascript
-----------------------------+------------------------------

Comment (by gziolo):

 Thank you for sharing initial ideas, @jonsurrell.

 >  Folks need to know whether they're using a module or a script, and they
 need to include the correct dependency and use it in the correct way:
 module dependencies are imported, script dependencies are used through
 globals.

 This approach would be manual as we don't have any automated way to detect
 `wp` globals and turn them into the list of dependencies even when using
 `@wordpress/scripts` tooling.

 Another challenge, unrelated to the approach proposed, is ensuring that
 scripts and the import map are printed in the correct order so that the
 browser can resolve everything correctly. At the moment, ES Modules and
 regular scripts don't know anything about themselves.

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


More information about the wp-trac mailing list