-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export default for isolatation package #136
Comments
I think it will be possible only if we solve the cjs export. |
How about applying export default only to esm? |
What do you mean? |
provide |
Do you mean: import OrderedSet from 'ordered-set';
const { OrderedSet } = require('ordered-set'); |
yes |
Why cjs cannot transform to |
The problem is when the named export exists together with default export. If you use named export, the value you received in However, it is generally impossible to be an object and a constructor of an object(a.k.a class) at the same time, so if you do default export at the same time as named export, one side is ignored. // lib.ts
class Foo { }
class Bar { }
class Baz { }
export { Foo, Bar };
export default Baz; // this will be ignored in CJS // index.ts
// This value will be { "Foo": [object Object], "Bar": [object Object] }
const lib = require('./lib.js');
// Because of the Destructuring, it seems like it is the same as a named export. But what the `require` returned was just an object
const { Foo, Bar } = require('./lib.js'); |
I think there must be some way to transform I'll promise the single file like Consider this tool: https://www.npmjs.com/package/ts-transform-default-export. |
Is your feature request related to a problem? Please describe.
Now:
Describe the solution you'd like
I want:
Additional context
It doesn't make sense because there is only one member has been exported which named
OrderedSet
.Does it possible? @noname0310
I think the problem will be
require
doesn't supportdefault
.The text was updated successfully, but these errors were encountered: