Single import from modules without default export

Marius Gundersen gundersen at gmail.com
Wed Aug 6 05:17:58 PDT 2014


On Wed, Aug 6, 2014 at 2:10 PM, Kevin Smith <zenparsing at gmail.com> wrote:

>
>> Completely agree, the default should be removed. This is simply a
>> proposal of how we can still have a simple import statement (`import $ from
>> "jQuery";`) without needing `default`.
>>
>>
> You know, I hate even suggesting any syntax changes at this point, but if
> we ditched the whole "default" thing, we could probably also get rid of the
> curlies:
>
>     import readFile, writeFile from "node:fs";
>
> And then "* as" would fit in naturally:
>
>     import * as FS, readFile from "node:fs";
>

I'm assuming this import the moduleObject?


> I think this might result in on overall better user experience.  I'll
> experiment with this from a parsing standpoint.
>
> What would you think about that?
>
>
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";
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140806/dd41e084/attachment.html>


More information about the es-discuss mailing list