Make WordPress Core

Opened 8 weeks ago

Last modified 8 weeks ago

#61771 new enhancement

Script Modules: add the importmap's scopes key

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

Description

WP_Script_Modules::print_import_map() prints the script modules, but it only prints the imports key.

As per described on the https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap#import_map_json_representation, <script type="importmap"> element can have another optional key: scopes and integrity.

There's no means for a plugin to add scopes to be printed.
So, besides the wp_register_script_module() function, we need a function to register the scopes.

The use case of using scopes are typical when we are using CDN providers such as https://generator.jspm.io/

Change History (1)

#1 @gziolo
8 weeks ago

  • Focuses javascript added
  • Version changed from trunk to 6.5
Note: See TracTickets for help on using tickets.