proposal-export-default-from icon indicating copy to clipboard operation
proposal-export-default-from copied to clipboard

Export all named and default as name

Open stevenvachon opened this issue 4 years ago • 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';

stevenvachon avatar Aug 12 '20 16:08 stevenvachon

I believe it's not currently part of it.

ljharb avatar Aug 12 '20 18:08 ljharb

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

hax avatar Aug 14 '20 02:08 hax

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

telmaantunes avatar Feb 18 '21 16:02 telmaantunes