Modules: use of non-module code as a dependency

David Herman dherman at mozilla.com
Sat Jun 30 11:19:39 PDT 2012


On Jun 30, 2012, at 11:06 AM, James Burke wrote:

> Possible answers:
> 
> 1) Unsupported. Error occurs.
> 
> 2) jQuery is suggested to provide a jquery.es.js file that uses the
> new keywords.
> 
> 3) Proposed: When jquery.js is compiled, and no import/module/export
> modules are found, then the Loader will execute jquery.js to see if it
> exports a value via a runtime API. It uses that value to then finish
> wiring up the local jQuery reference for module foo.

I'm curious why you didn't include what seems like the most straightforward answer to me: jQuery continues to work as it did before, and just like always, you include it via a script tag and subsequently access it as a global:

<script src="jquery.js"></script>
<script>
... $('#foo').blah().blah() ...
</script>

I'm wondering why you didn't include this option -- is it just because jQuery is a special case that creates globals, whereas you also want this to work for modules that don't create globals?

Dave



More information about the es-discuss mailing list