Are ES6 modules in browsers going to get loaded level-by-level?

John Barton johnjbarton at google.com
Thu Apr 16 20:06:15 UTC 2015


On Thu, Apr 16, 2015 at 12:18 PM, Domenic Denicola <d at domenic.me> wrote:

> > Is there any mean in sight, that will allow us to serve
> > them as fast as we can serve hundreds of bundled and minimized CJS
> > modules now?
>
> Yes. Any browser which implements the ES6 module loader (none of them
> right now) will also be a browser that implements HTTP/2 (all of them right
> now). HTTP/2 server push would allow you to respond to a single request for
> "entry.js" (e.g. from `<script type="module" src="entry.js"></script>`)
> with responses for all modules in the entire dependency graph, prioritized
> according to their level in the graph, all over a single TCP connection.
>
> This is just the most naïve strategy I could think of with HTTP/2. There
> are more interesting ones too.
>
> It's also important to note that bundling is an antipattern in the HTTP/2
> world, as it prevents incremental cache updates by invalidating the entire
> bundle graph when you change a single file, and does not allow relative
> prioritization of individual files.
>

But the push scenario in your first paragraph would not use the cache
either.

As far as I can tell, only the client knows which modules it has loaded;
only the server knows the dependency graph for modules-to-be-loaded. So:
  one or the other has to send its information at the outset of a import
request, or
  the server needs to send the entire bundle, or
  the loading has to be layer by layer.
HTTP/2 does seem to have the magic to avoid considering these issues in
module loading.

jjb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150416/921f2cdc/attachment.html>


More information about the es-discuss mailing list