Export * as name from "source"

# Lee Byron (10 years ago)

I’m curious of this history behind this case being missing, I’ve been crawling through the spec and old esdiscuss and can’t find it:

I expected the following:

export * as someName from "module”;

To behave much like:

Import * as someName from "module”; export someName;

Except without adding “someName” to this module’s scope.

In common-js terms, transpiled to:

exports.someName = require(“module”);

Does anyone have context as to why this piece of syntax doesn’t exist? Is there a case to be made to incrementally add it in ES7?

  • Lee Byron
# caridy (10 years ago)

right, there were a couple of export declaration cases that we missed for ES2015. From the top of my head, I remember export default from “module”; which we plan to get on the fast lane for ES2016, ideally they will be spec’d (and in stage 2) by the time vendors start implementing modules :)

as for the one you mentioned, we can discuss it for sure, but at first glance it sounds be very confusing, thinking about:

export * as foo from “foo”; // export a namespace export * from “foo”; // export a batch

As today, we don’t have bindings to a module instance, that’s something new :)

the question here is, how much sugar are we willing to pile up?