Closed
Description
Hi,
I have a hard time figuring out a solution for having both a default and named export in a package. (Yes, that sounds like a bad idea, but if we could prevent a breaking change...). It's using TypeScript.
// package index.ts
function foo() {}
export { foo };
export default foo;
Get compiled into:
function e() {}
;(exports.foo = e), (exports.default = e)
Then trying to import the package in a Babel environment:
// consumer index.js
import foo from 'foo';
foo();
$ babel-node index.js --presets @babel/env
(0, foo.default)();
TypeError: (0 , foo.default) is not a function
So it basically lacks the interop thing:
Object.defineProperty(exports, "__esModule", {
value: true
});
;(exports.foo = e), (exports.default = e)