Default exports, without explicit syntactic support

Axel Rauschmayer axel at
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.

// 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:

import fs from "fs";

fs.renameSync('foo.txt', 'bar.txt');

Dr. Axel Rauschmayer
axel at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list