-
Notifications
You must be signed in to change notification settings - Fork 56
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
<link> rel="modulepreload" #213
Comments
Discussed at London F2F. |
Hey all, Took this up at this week's F2F in London. Thanks for filing a design review. We've looked through the design doc and now (relatively old) issues around the design and understand that the design space is highly contended. It looks like all permutations of
Overall this looks good and the design seems to be a good compromise in a difficult space. Best of luck with your implementation. |
You can polyfill whatwg/fetch#486 (comment) addresses to some extent why it wasn't generalized, but I certainly agree with your impression that there's more to explore around the commonalities of CSS and script loading. A somewhat big problem we have today is that the former isn't properly defined. |
So it isn't actually clear that you can polyfill this for CSS. Is it possible to actually get access to all of the bytes for all I agree that let sheet = await fetch("sheet.css");
let deps = await sheet.dependencies(); // an iterable of URLs? IDK. |
TAG has been discussing the scope and nomenclature around this. I am wondering whether you considered creating an additional directive, to indicate that preload should additionally explore the dependency graph of the resource, in a similar vein to the Example: Link: </path/to/something>; rel=preload; as=script; includeDependencies <link rel="preload" href="/path/to/something" as="script" includeDependencies> |
We did indeed explore that. However, as noted in whatwg/fetch#486 (comment), the dependency-crawling is only a small aspect of the overall behavior change that makes using preload a bad fit. Notably, this is not a preload in the network fetching sense, and does not involve the preload cache; it preloads into the module map, which is very different. |
But doesn't it also require that you fetch the resources in order to populate the map correctly? It sounds like that's also not great layering. Maybe they can be separated somehow? |
It depends. Fetching subresources is an optional part of modulepreload, and not the most important part. Populating the module map is the primary goal. I don't really agree with the value judgments about the layering here, but am not sure how to make that a productive conversation. |
Bonjour @domenic. Was thinking about https://github.com/domenic/package-name-maps and how modulepreload relates, and wondered what you think the relationship is between the two? Some thoughts below:
|
I think they're mostly orthogonal, but I agree it's tempting to stretch package name maps (now renamed import maps) to cover similar cases. In particular:
Import maps are not about loading at all. They're about how to translate certain strings into HTTP(S) URLs. In particular, the format used for specifying this string -> URL translation cannot be used to derive an exhaustive list of the URLs of all modules in an app. This is for two reasons:
As explained above, it would probably end up being a subset, or perhaps just overlapping. We could say that, for the subset of modules that appear by explicit URL in the module map, there could be a hint added to the module map to preload them. (Or, browsers may want to do so anyway, without an explicit hint.) But, given that we'd still need modulepreload for other cases, I'd be hesitant to add this. It seems nicer to keep the preloading and string -> URL translation mechanisms separate. Thoughts welcome.
Exactly :) |
We had a brief discussion and will have a breakout later. Some questions that came up:
|
Hello! I'm a developer that's using I made a I think (FWIW, from an app developer perspective, I have no preference for either Thanks for your consideration. |
@cynthia and I looked at this in a breakout at the TAG face-to-face in Reykjavík. I think the thing that's bothering us the most is the optionality of the dependency loading. It seems like the spec should either define one behavior or the other rather than allowing implementations to do either. Making it optional means that authors will have to list all their dependencies if they want them to all preload. It's not clear to me what the argument against loading dependencies is. Is it simply a question of value to developers (and users, for better performance) versus browser implementor convenience? Or is there something deeper that makes the dependency loading complex? The example shows a very long list of From the earlier discussions it seems like there are two future feature requests that we don't need to hold up this review for, but that we should note:
|
I filed one of those feature requests as whatwg/html#5208. I'm now less confident that the second is worth filing. It's not clear to me what sort of results a generic recursive-fetching API would want to return. I think the useful ones build particular data structures (e.g., module graphs, stylesheet objects) and thus aren't generic. |
We discussed this on a breakout meeting today and will propose that (in the plenary meeting in 2 days) we close this issue. It's been open a long time. We've provided some feedback (perhaps later than we should have), not much has happened regarding that feedback, and it's not clear whether it's too late for that feedback to be acted upon (although it seems like it's the sort of thing where it likely could be). But it doesn't seem like very much will happen as a result of keeping the issue open, so it's probably time to close it. |
Dear Sirs and Madam of TAG!
I'm requesting a TAG review of:
linktypes
Further details (optional):
link rel=preload
.We'd prefer the TAG provide feedback as (please select one):
The text was updated successfully, but these errors were encountered: