Proposal: export ** from './FooBar'

Cyril Auburtin cyril.auburtin at gmail.com
Fri Mar 1 06:34:30 UTC 2019


Sometimes, (particularly in React codebases) you have to write many lines
like:
```js
export { default as FooBar } from './FooBar';
```
It could be automated of course

It could also be tuned into
```js
export * from './FooBar';
```
only if FooBar is also a named export in that file, but usually files with
one export just use a default export

------
This proposed syntax:
```js
export ** from './FooBar';
```
Would do:
```js
export * from './FooBar';
export { default as FooBar } from './FooBar';
```
the filename is used as default export name.

If the filename isn't a valid JS identifier, like 'foo-bar' for example, it
would throw
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190301/01801417/attachment-0001.html>


More information about the es-discuss mailing list