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

"exports" field named exports support #121

Closed
wants to merge 3 commits into from

Conversation

guybedford
Copy link
Contributor

Many packages use patterns like import { __assign } from 'tslib' which breaks down in Node.js and environments that provide Node.js-style CommonJS interop.

Using the "exports" field we can ensure that ES importers get the expected shape with named exports.

//cc @weswigham @DanielRosenwasser

"import": "./tslib.es6.js",
"default": "./tslib.js"
},
"./": "./"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this one? What will break if we don't include it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly for require.resolve use cases and exactly makes this backwards compatible. For example:

  • require.resolve('tslib/tslib.d.ts')
  • require.resolve('tslib/package.json')
  • require.resolve('tslib/tslib.es6.js')
  • require('tslib/tslib.js')

@orta
Copy link
Contributor

orta commented Oct 6, 2020

This is now in with #126 - thanks for the feedback Guy!

@orta orta closed this Oct 6, 2020
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

Successfully merging this pull request may close these issues.

3 participants