Are ES6 modules in browsers going to get loaded level-by-level?
caridy at gmail.com
Thu Mar 26 20:21:33 UTC 2015
The issue you're describing exists today, and it is the main reason why we do bundling (a la webpack, browserify, etc.).
ES6 modules are not introducing any new restriction here, it is just the way things work. HTTP2 is suppose to help in this regards, but only a little bit. In my experience, loading the modules is not even the biggest issue here, but executing 500 modules is, because it will require at least an order of magnitud more promises to be resolved, plus all the other normalization logic. This is where "folding" might help us. Assuming you have a huge tree of modules, we could analyze that tree and fold it into few modules that are key for the application to function, then fetching and executing those modules should not be a big deal, this is very similar to bundling as we know it today but without sacrificing module semantic, and loader advanced functionalities.
In any case, this should not prevent us from writing modules using ES6 import and export declarations today.
> On Mar 26, 2015, at 3:08 PM, Wizek <123.wizek at gmail.com> wrote:
> *I've been redirected from here: https://github.com/tc39/ecma262/issues/27#issuecomment-84474257 <https://github.com/tc39/ecma262/issues/27#issuecomment-84474257> . Not sure if this is a good place to ask this question. If not, I'm sorry for the noise. Could you then point me elsewhere perhaps?*
> I've just read this post here: http://www.2ality.com/2014/09/es6-modules-final.html <http://www.2ality.com/2014/09/es6-modules-final.html>
> Which claims that the module system will support both sync and async loading. Which I like. But it made me wonder if/how well async loading would work for deeper dependency trees. E.g. if I had a project with 20 level deep dependency tree (at its deepest point) and my server would take on average 200ms to respond, then it would take about 4000ms minimum to execute any/all of my scripts, right? Or is there something I am missing?
> If I interpret the situation correctly, what is the conceptual response to this scenario? Try to limit the tree depth? Concat everything just like it happens often with ES5? Something else?
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss