Generic Bundling

Andrea Giammarchi andrea.giammarchi at gmail.com
Mon Oct 14 16:35:03 PDT 2013


Inline, from the Moon


On Mon, Oct 14, 2013 at 2:22 PM, Jorge Chamorro <jorge at jorgechamorro.com>wrote:
>
> What I meant with round-trip latency is: once the connection has been
> established


I was talking about this latency, those 500ms in my example



> , a network packet takes almost 250 ms to go


while my 100ms per request were the equivalent of the 250 you are talking
about here.

So we are saying the same thing, I just defined, probably wrongly, the
roundtrip, only the "first-contact" one.



> The only work around for that is making as few requests as possible.


never said the opposite, and if you read the repo I've pointed out you'll
realize I've already done this pragmatically but nobody seemed to be
interested at that time.

I have an inline require that uses Function over modules on demand but all
modules are packed in a single minzipped JSON object

```javascript
// the equivalent of your file.zip in my case
{
  "module1":"content as string 1",
  "module-N":"other content"
}
```

The object does, inline, a similar require so that

```javascript
if (!modules[name])
Function(object[name]).call(module,global,require,module);
```

and you have inline require that does  in development the synchronous Ajax
call.

Compared with the zip solution, if targeting only javascript, it gives you
modules behavior, you still need to pack them all together, you will still
use minifiers before packing to save as many bytes as possible so debug is
hard in any case and bugs introduced by minifiers could still be there but,
as it would be for the JS zip solution, you could just inline as text he
whole script without minifier ^_^


the extra plus is given by the ability to use an initialization inside the
script so that

```
<script src="package.js" exec>
  require('any-module-in-package').init();
</script>
```

or something similar. In few words create a pre-minzipped package file is
kinda possible but I am with you about having this standardize and
simplified without the need for HTTP2.

Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131014/9c584440/attachment-0001.html>


More information about the es-discuss mailing list