tc39 / proposal-import-attributes

Proposal for syntax to import ES modules with assertions
https://tc39.es/proposal-import-attributes/
Apache License 2.0
569 stars 32 forks source link

Support link modulepreload #118

Closed uasan closed 2 years ago

uasan commented 2 years ago

Hello. The current implementation in Chrome does not support the <link rel=modulepreload> https://bugs.chromium.org/p/chromium/issues/detail?id=1274871

The specification says that you can specify the as attribute

Let destination be the current state of the as attribute (a destination), or "script" if it is in no state. https://html.spec.whatwg.org/multipage/links.html#link-type-modulepreload

But as not support and has not valid as value for type json module.

Perhaps it makes sense to add support for the type attribute?

<link rel="modulepreload" href="app.mjs"> - for ESM module
<link rel="modulepreload" href="style.css" type="text/css"> - for assert: { type: 'css' }
<link rel="modulepreload" href="data.json" type="application/json"> - for assert: { type: 'json' }

Thanks.

uasan commented 2 years ago

Moved: https://github.com/whatwg/html/issues/7388