Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fetchPriority with external import maps #2478

Closed
erikt9 opened this issue Jan 5, 2024 · 1 comment · Fixed by #2477
Closed

Support fetchPriority with external import maps #2478

erikt9 opened this issue Jan 5, 2024 · 1 comment · Fixed by #2477

Comments

@erikt9
Copy link
Contributor

erikt9 commented Jan 5, 2024

Description of Proposed Feature

When using an external import map, it seems to be a common use case where loading the map is blocking the loading of multiple modules on the page. It would be nice if we can boost loading priority of the external import map using the fetchPriority property of <script>tags.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement

fetchPriority on scripts is supported in both Chrome and Safari now (and browsing through Firefox it looks like they are making steady progress). Support for the similar priority property of fetch calls is identical. Would be nice if we could leverage this standard for a little boost in modern browsers.

This also helps alleviate the problem that using <link rel="preload" as="fetch" src="import_map.json"> is difficult to get working in a cross browser fashion (https://stackoverflow.com/questions/52635660/can-link-rel-preload-be-made-to-work-with-fetch) and even the cross browser method wouldn't work with SystemJS without making a completely custom fetch method to pass the correct options.

Invoke like:
<script type="system-js-importmap" src="https://import_map_url" fetchpriority="high" />

In what way would you use it?

Increase priority of import map loading (could also lower if appropriate for your app).

@erikt9
Copy link
Contributor Author

erikt9 commented Jan 5, 2024

PR #2477

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant