Calvin Metcalf (2014-09-26T20:02:03.000Z)
true and by that same token it is possible to use the loader api to get
similar results out of ES6 modules (
https://github.com/calvinmetcalf/es6-translate)

On Fri, Sep 26, 2014 at 3:46 PM, Bradley Meck <bradley.meck at gmail.com>
wrote:

> > ```js
> > var moduleName = 'foo';
> > var foo = require(moduleName);
> > ```
> >
> > would not work in browserify either
>
> It does work in browserify, but you need to be sure to include it in a
> list of requires if it is not imported by the current list of files
> statically (ala `browserify -e main.js -r foo`).
>
> On Fri, Sep 26, 2014 at 12:21 PM, Calvin Metcalf <calvin.metcalf at gmail.com
> > wrote:
>
>>
>> ```js
>> var moduleName = 'foo';
>> var foo = require(moduleName);
>> ```
>>
>> would not work in browserify either
>>
>> On Fri, Sep 26, 2014 at 12:40 PM, Konstantin Ikonnikov <
>> ikokostya at gmail.com> wrote:
>>
>>> I don't want load module using http request. In my case module already
>>> defined and I want import it later when I get its name:
>>>
>>> ```js
>>> var moduleName = getModuleName();
>>> import { foo } from moduleName;
>>>
>>> // use foo
>>> ```
>>>
>>>
>>>
>>> 2014-09-26 20:00 GMT+04:00 Marius Gundersen <gundersen at gmail.com>:
>>>
>>>> And the reason you cannot import a module synchronously is that it
>>>> would freeze the entire browser until the http request completes, which
>>>> could be several seconds on a slow internet connection.
>>>>
>>>> If you want to import something dynamically you can do it using the API
>>>> (to be finalized, I believe):
>>>>
>>>> ```js
>>>> var moduleName = 'foo';
>>>> Loader.import(moduleName).then(function(foo){
>>>>   //use foo here
>>>> });
>>>> ```
>>>>
>>>> Marius Gundersen
>>>>
>>>> On Fri, Sep 26, 2014 at 5:29 PM, John Barton <johnjbarton at google.com>
>>>> wrote:
>>>>
>>>>> no.
>>>>>
>>>>> On Fri, Sep 26, 2014 at 8:12 AM, Konstantin Ikonnikov <
>>>>> ikokostya at gmail.com> wrote:
>>>>>
>>>>>> Can I import module dynamically, but synchronously? Example for
>>>>>> common js
>>>>>>
>>>>>> ```js
>>>>>> var moduleName = 'foo';
>>>>>> var foo = require(moduleName);
>>>>>> ```
>>>>>>
>>>>>> In es6 draft I found that ModuleSpecifier must be a StringLiteral
>>>>>> http://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports
>>>>>>
>>>>>> _______________________________________________
>>>>>> es-discuss mailing list
>>>>>> es-discuss at mozilla.org
>>>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> es-discuss mailing list
>>>>> es-discuss at mozilla.org
>>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>>>
>>>>>
>>>>
>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>>
>>
>>
>> --
>> -Calvin W. Metcalf
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>


-- 
-Calvin W. Metcalf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140926/0cd71e51/attachment.html>
domenic at domenicdenicola.com (2014-09-30T16:51:13.139Z)
true and by that same token it is possible to use the loader api to get
similar results out of ES6 modules (https://github.com/calvinmetcalf/es6-translate)
domenic at domenicdenicola.com (2014-09-30T16:51:07.270Z)
true and by that same token it is possible to use the loader api to get
similar results out of ES6 modules (
https://github.com/calvinmetcalf/es6-translate)