Single import from modules without default export

Kevin Smith zenparsing at gmail.com
Wed Aug 6 05:26:30 PDT 2014


>
>
>> And then "* as" would fit in naturally:
>>
>>     import * as FS, readFile from "node:fs";
>>
>
> I'm assuming this import the moduleObject?
>

Right - "import * as ..." is the new syntax for importing all names into a
namespace binding ("FS" in this case), approved at the last TC39 meeting.


> You still miss the ability to import a single-export module and naming it
> whatever you want to. How would recreate the following node code in ES6?
>
> ```js
> //nodeJS
> var $ = require("jQuery");
>
> //ES6
> import {jQuery as $} from "jQuery";
> ```
>
>
"jQuery" would just export "$" as a name (an alias for the "jQuery"
variable), like it currently injects "$" into the global object.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140806/ffed8287/attachment.html>


More information about the es-discuss mailing list