[wp-trac] [WordPress Trac] #60970: Remove importmap polyfill

WordPress Trac noreply at wordpress.org
Tue Apr 9 16:08:34 UTC 2024


#60970: Remove importmap polyfill
---------------------------+--------------------------
 Reporter:  swissspidy     |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  6.6
Component:  Script Loader  |    Version:  6.5
 Severity:  normal         |   Keywords:  dev-feedback
  Focuses:                 |
---------------------------+--------------------------
 In #60348 / [57492] a polyfill was added for import maps
 (`type="importmap"`).

 From what I can see, all browsers supported by WordPress actually already
 do support import maps, so there isn't really a reason to include this
 polyfill.

 For reference:

 * [https://caniuse.com/mdn-html_elements_script_type_importmap caniuse.com
 data]
 * [https://make.wordpress.org/core/handbook/best-practices/browser-
 support/ WordPress browser support policy]


 If you take the list of supported browsers from that page (also available
 [https://github.com/WordPress/gutenberg/blob/5e994543c63052cbe8d97e975dfb82d46554e82e/packages
 /browserslist-config/index.js in this browserslist config]) and
 [https://browsersl.ist/#q=%3E+1%25%0Alast+1+Android+versions%0Alast+1+ChromeAndroid+versions%0Alast+2+Chrome+versions%0Alast+2+Firefox+versions%0Alast+2+Safari+versions%0Alast+2+iOS+versions%0Alast+2+Edge+versions%0Alast+2+Opera+versions
 test it on the browserslist website], you'll only get browsers that
 already support import maps.

 Thus, I propose removing this polyfill again by not printing it anymore in
 `\WP_Script_Modules::print_import_map()`

 Note: actual performance impact is minimal as on all these browsers, no
 extra script is loaded. It's just a bit of unnecessary inline JS sent over
 the wire.

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


More information about the wp-trac mailing list