restrictions on module import export names

Domenic Denicola domenic at domenicdenicola.com
Wed Jan 29 18:51:14 PST 2014


I would really encourage you to read the spec grammar.

> ```js
> export foo();
> ```

This is not allowed by the grammar; there is no form `export <expression>`

> ```js
> export default let a = [thing1, thing2];
> ```

This is not allowed by the grammar; `let a = [thing1, thing2]` is not an AssignmentExpression.

> ```js
> let app = module.exports = require('express')();
> ```

Try

```js
import express from "express";
let app = express();
export default app;
```


From: Calvin Metcalf [mailto:calvin.metcalf at gmail.com] 
Sent: Wednesday, January 29, 2014 21:46
To: Jason Orendorff
Cc: Domenic Denicola; Erik Arvidsson; EcmaScript
Subject: Re: restrictions on module import export names

ok so would this be accurate https://gist.github.com/calvinmetcalf/8701624 ?

the syntax does make it impossible to write something equivalent to

```js
let app = module.exports = require('express')();
```

On Wed, Jan 29, 2014 at 6:40 PM, Jason Orendorff <jason.orendorff at gmail.com> wrote:
On Wed, Jan 29, 2014 at 3:39 PM, Calvin Metcalf
<calvin.metcalf at gmail.com> wrote:
> *would be equivalent of it was allowed
>
>[...]
>> So the following are equivalent?
>>
>> ```js
>> export default foo();
>> export let default = foo();
>> ```
Yes.

-j




-- 
-Calvin W. Metcalf 


More information about the es-discuss mailing list