[wp-trac] [WordPress Trac] #61500: Script Modules: Allow scripts to depend on modules
WordPress Trac
noreply at wordpress.org
Tue Jun 25 14:44:12 UTC 2024
#61500: Script Modules: Allow scripts to depend on modules
-------------------------------------+-----------------------------
Reporter: jonsurrell | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version: 6.5
Severity: normal | Keywords:
Focuses: javascript, performance |
-------------------------------------+-----------------------------
WordPress supports JavaScript modules via the Script Modules API.
Classic Scripts would benefit from the use of Script Modules to take
advantage of some benefits like conditional and deferred loading, but
classic Scripts have no way of declaring a dependency on Script Modules.
Classic scripts can use the "dynamic" `import( 'module-id' )` to import
JavaScript modules, but there's currently no way to declare the dependency
so that dependent modules are included in the import map, making this
usage problematic in WordPress.
Ideally, Scripts should be able declare Script Module dependencies so that
scripts can safely use modules.
This complements https://core.trac.wordpress.org/ticket/60647 which seeks
to add more functionality to Script Modules.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61500>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list