Are ES6 modules in browsers going to get loaded level-by-level?
d at domenic.me
Thu Apr 16 20:22:15 UTC 2015
From: John Barton [mailto:johnjbarton at google.com]
> But the push scenario in your first paragraph would not use the cache either.
Yeah, that's what I was alluding to with the "most naïve" comment.
> one or the other has to send its information at the outset of a import request, or
One way of doing this I came up with off the top of my head is to add some kind of "dependency graph version" or hash to the query string. I.e. <script type="module" src="entry.js?1234"></script>. The server can then assume that the client has in its cache version 1234 of the dependency graph, and can push the incremental updates since then (i.e. added or modified files). If parts of the cache were evicted, so that the versioning signal is not entirely accurate, then the penalty is not so bad, as you just fall back to the normal loading process for the evicted subset.
But I feel pretty silly speculating here as I'm not an expert on HTTP/2 techniques, and there are probably other methods that are better in various ways.
More information about the es-discuss