[wp-trac] [WordPress Trac] #61771: Script Modules: add the importmap's scopes key

WordPress Trac noreply at wordpress.org
Fri Jul 26 13:35:30 UTC 2024


#61771: Script Modules: add the importmap's scopes key
---------------------------+-----------------------------
 Reporter:  rosua          |      Owner:  (none)
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Script Loader  |    Version:  trunk
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 `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/

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61771>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list