Default exports, without explicit syntactic support
Axel Rauschmayer
axel at rauschma.de
Thu Jun 26 02:46:03 PDT 2014
(I’m happy with David’s proposal, but I’d like to try bikeshedding one more time.)
Building on an idea by Kevin Smith: how about supporting default exports without any explicit syntactic constructs? The convention would be: the name `"_"` is used for default exports. The following is a single-export module.
```js
// lib/MyClass.js - alternative A
export const _ = class {
...
};
// lib/MyClass.js - alternative B
export class _ {
...
}
// main.js
import { _ as MyClass } from "lib/MyClass";
```
Importing a multi-export module:
```js
import fs from "fs";
fs.renameSync('foo.txt', 'bar.txt');
```
--
Dr. Axel Rauschmayer
axel at rauschma.de
rauschma.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140626/ebfcac31/attachment.html>
More information about the es-discuss
mailing list