tc39/proposal-export-default-from

Export all named and default as name

Opened this issue · 3 comments

It's not clear if this behaviour is part of this proposal. If it is not currently a part of it, its syntax could look something like:

export v, * from "mod";

This is useful because export * will not include any default exports and export * as v forces us to do this ugliness:

import v from "mod";
v.default();

The Goal

app.mjs:

import { CONSTANT_A, CONSTANT_B, funcA, funcB } from 'package';
funcA(CONSTANT_A);
funcB(CONSTANT_B);

package-index.mjs:

export funcA, * from './package-funcA.mjs';
export funcB, * from './package-funcB.mjs';

package-funcA.mjs:

export default arg => arg;
export CONSTANT_A = 'value-a';

package-funcB.mjs:

export default arg => arg;
export CONSTANT_B = 'value-b';

I believe it's not currently part of it.

hax commented

There is a section in README, but not sure why export v, * from 'mod' was not mentioned.

It would be nice to see this part of the behaviour 👍