Modules and dependencies known before the load

Ian Hickson ian at
Wed Aug 13 15:52:01 PDT 2014

On Wed, 13 Aug 2014, John Barton wrote:
> On Wed, Aug 13, 2014 at 2:59 PM, Ian Hickson <ian at> wrote:
> >
> > Suppose a page has this markup:
> >
> >    <script type=module id=jquery href="jquery.js" whenneeded></script>
> >    <script type=module id=a href="a.js" uses="jquery" whenneeded></script>
> >    <script type=module>
> >     import "a";
> >     // ...
> >    </script>
> Your example will just work if you just use
>    <script type=module>
>     import "a";
>     // ...
>    </script>
> When this module is compiled the other two will be loaded and compiled.

That assumes that you have some sort of server-side support so that the 
server knows that when you request "a", it should send "a.js" and 
"jquery.js", which is an assumption that will work for some people but not 
everyone. One of the big pieces of feedback I am dealing with on the HTML 
side is a request for a way to predeclare the dependency graph to avoid 
this problem (so that the browser knows to request a.js and jquery.js at 
the same time). People apparently have huge difficulties even getting 
their servers configured to send the right MIME types, let alone getting 
the servers to know about dependencies.

(If you don't have either server-side support or client-side dependency 
predeclaration, you end up having to discover the dependency chart at 
runtime, which is a huge latency loss.)

Ian Hickson               U+1047E                )\._.,--....,'``.    fL       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the es-discuss mailing list