Quantifying Default Exports

Juan Ignacio Dopazo jdopazo at yahoo-inc.com
Mon Jul 21 06:34:11 PDT 2014

> On Saturday, July 19, 2014 1:53 PM, Brian Di Palma <offler at gmail.com> wrote:

> When an npm package exports a named identifier it's trivial to use it
in an ES6 module.

import {
} from 'recast';

> When on the other hand it sets its export on `module.exports` default
exports provide no help at all.

This sounds like an issue in your transpiler. Ideally CJS modules inside projects written using ES6 modules should be treated as modules that default export an object. CJS modules don't have the same static semantics as their ES6 counterpart, so they should be treated as mutable objects. An ES6 Loader would do the same when loading CJS modules.


More information about the es-discuss mailing list