Make WordPress Core

Opened 4 weeks ago

#61500 new enhancement

Script Modules: Allow scripts to depend on modules

Reported by: jonsurrell's profile jonsurrell Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.5
Component: Script Loader Keywords:
Focuses: javascript, performance Cc:


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 which seeks to add more functionality to Script Modules.

Change History (0)

Note: See TracTickets for help on using tickets.