Skip to content
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

Use standard exports in package.json #183

Closed
benmccann opened this issue Oct 14, 2022 · 3 comments
Closed

Use standard exports in package.json #183

benmccann opened this issue Oct 14, 2022 · 3 comments

Comments

@benmccann
Copy link

tslib has a module entry in the exports, which is non-standard. It's unclear to me why this has been added or would be needed. I couldn't find any code comments explaining it various entry points. At the very least, it would be nice to add comments explaining this setup. However, I have a very strong feeling it's setup improperly and should be fixed. Looking through the issue tracker, it seems there's quite a lot of packaging issues in this library.

Vite has added support for module to its codebase, but it's a rather messy thing I'd rather not keep around long-term.

@weswigham
Copy link
Member

weswigham commented Oct 14, 2022

webpack and other bundlers use it - it's for scenarios where the bundler ensures esm and cjs are drop-in replacements for one another, so only loads one copy of a module (the module version), unlike node, which loads two (the require and import version), and we need to take steps to ensure only one copy of the code is loaded (but still presents the right named exports).

It's entirely "standard" in that regard.

@weswigham
Copy link
Member

FYI, the node docs page for conditions here may not list module, but it 100% meets the bar for inclusion (it's well supported by a tool in the ecosystem already and a bunch of packages use it, not just tslib) - nobody's added it yet though because it's just an as-requested thing.

@benmccann
Copy link
Author

Ok, thanks for the explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants