proposal-export-default-from
proposal-export-default-from copied to clipboard
Export all named and default as name
~~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.
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 👍