Files
meteor/packages/modules-runtime
Ben Newman 305abbefb8 Upgrade install to allow batching of dynamic import() requests.
Now that we're using HTTP POST requests to fetch dynamic modules, it's
more important to make fewer requests when possible, given the higher
latency of HTTP requests compared to WebSocket messages.

The trick is to wait until the next tick of the event loop before actually
sending the request, so that multiple dynamic import() calls in quick
succession are treated as a single request, and all the modules they
require can be returned in a single response object.

For example, we want code like this

  const [
    React,
    ReactDOM
  ] = await Promise.all([
    import("react"),
    import("react-dom")
  ]);

to result in one HTTP POST request for both `react` and `react-dom`, as
well as all their dependencies, rather than two separate requests.
Indeed, that is what happens, since both import() calls take place in the
same tick of the event loop.
2017-11-16 19:49:06 -05:00
..
2016-08-30 15:40:14 -07:00

modules-runtime

Source code of released version | Source code of development version


This package implements the meteorInstall function that is used and re-exported by the modules package. Do not depend directly on this package (unless you know what you're doing); depend instead on the modules package.