You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor: convert to ESM module (.js files) #19719
I don't believe that's always the case. It doesn't appear to be true for Babel's
CommonJS output and TypeScript's System.register transform also behaved differently the last time I checked.
Can you clarify what you mean by the second comment? If I write export function foo() {} I can access it from a .mjs file just fine with import { foo } from "./a";.
Yes, I did not mean to imply otherwise. All exports (except the default export if present) are reexported by export * from "m";
Here is the specification text that describes the default exclusion.
By second I meant the one starting with And perhaps the second should be.
Ah, sorry, my brain kind of went to sleep for a second 😪.
I meant that since Node.js is not yet supporting named exports, unless something has changed, and since this concerns a refactoring transformation that might be output using --module es2015, it might make sense for the refactoring to place properties on the default export instead of creating named exports.
I'm not sure about this since it depends on how the imports are transpiled if at all.
Activity
aluanhaddad commentedon Nov 7, 2017
Of the last two, perhaps the first should be
since the
export *should excludedefault.And perhaps the second should be
as, if the module is consumed natively as an ESM by a NodeJS ESM, the named export
foowould not be available at all otherwise.aluanhaddad commentedon Nov 10, 2017
I don't believe that's always the case. It doesn't appear to be true for Babel's
CommonJS output and TypeScript's
System.registertransform also behaved differently the last time I checked.aluanhaddad commentedon Nov 10, 2017
Yes, I did not mean to imply otherwise. All exports (except the
defaultexport if present) are reexported byexport * from "m";Here is the specification text that describes the
defaultexclusion.https://tc39.github.io/ecma262/#sec-getexportednames
See section 7.c.i
rbuckton commentedon Nov 10, 2017
Aluan Haddad (@aluanhaddad) is correct,
defaultis excluded from re-exports usingexport * from ...syntax.aluanhaddad commentedon Nov 10, 2017
Andy (Andrewkraft) (@Andy-MS)
Ah, sorry, my brain kind of went to sleep for a second 😪.
I meant that since Node.js is not yet supporting named exports, unless something has changed, and since this concerns a refactoring transformation that might be output using
--module es2015, it might make sense for the refactoring to place properties on thedefaultexport instead of creating named exports.I'm not sure about this since it depends on how the imports are transpiled if at all.