tc39 / proposal-source-phase-imports

Proposal to enable importing modules at the source phase
https://tc39.es/proposal-source-phase-imports/
MIT License
129 stars 9 forks source link

`export source x from "y"` #46

Closed lucacasonato closed 1 year ago

lucacasonato commented 1 year ago

Should we also add this as a shorthand for:

import source x from "y";
export { x };
guybedford commented 1 year ago

export { a } from 'b' will not create a local a binding, instead it is only the external binding name.

Similarly, perhaps an export source x from 'y' would do the same thing by default - that is, it is not a shorthand but a new syntax entirely.

We could in theory decide either way though.

jridgewell commented 1 year ago

Note that we still don't have export foo from "foo" syntax: https://github.com/tc39/proposal-export-default-from

ljharb commented 1 year ago

oh true, in that case that proposal would add export source foo from 'foo' as part of adding export foo from 'foo'.

that underscores, though, the need for that proposal, since export source { default } from 'foo' wouldn't be available as a workaround otherwise.

lucacasonato commented 1 year ago

We decided during the Module Harmony call to defer this until export foo from "foo" is a thing to not create asymmetry.

Something for a follow up proposal (or included in the default export proposal).