- From: Domenic Denicola <notifications@github.com>
- Date: Thu, 09 Feb 2017 14:31:58 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/486@github.com>
### The problem Given `<link rel="preload" href="foo.js" as="script">`, we don't know whether foo.js will be a classic script or module script. This means that we can't parse it ahead of time. Additionally, for module scripts I'd expect preloading the module script to also preload its dependencies. ### Potential solutions We could solve this in one of two ways, as far as I can see: 1. `<link rel="preload" href="foo.js" as="module">` or some other similar destination (e.g. `modulescript`) 2. `<link rel="preload" href="foo.js" as="script" type="module">` (2) was initially rather attractive to me, for matching the syntax used by the `<script>` element. Note that there's no conflict with the existing semantic of `type=""` being a MIME type, since in practice that is not used by any part of the HTML or preload specs. But now I am less sure. It seems hard to spec it in a clean way. We'd either need to thread the type="" metadata through all the fetch locations (including e.g. service worker, not just the preload spec, right?), or we'd need to create some sort of "shadow destination", so breaking the 1:1 mapping of as="" and request destinations. That sounds not great. I'd love thoughts on the best way to go here. If (1) is the way to go then we can just Bikeshed the destination name and update HTML to use it when fetching module scripts. /cc @addyosmani @yoavweiss @whatwg/modules -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/486
Received on Thursday, 9 February 2017 22:32:31 UTC