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

Export uuid as default as well #465

Closed
wants to merge 1 commit into from
Closed

Export uuid as default as well #465

wants to merge 1 commit into from

Conversation

franciscop
Copy link

This allows people to do:

import uuid from 'uuid';
uuid.v4();

It also helps with this Jest issue, but I think allowing for the above on itself is merit enough for this PR.

This allows people to do:

```js
import uuid from 'uuid';
uuid.v4();
```

It also [helps with this Jest issue](https://stackoverflow.com/a/62210156/938236), but I think allowing for the above on itself is merit enough for this PR.
@ctavan
Copy link
Member

ctavan commented Jun 5, 2020

@franciscop thank you for the suggestion.

We deliberately removed the default export with the uuid@7 release.

Could you elaborate on why adding a default export changes anything for jest in particular?

Isn't this more a problem of Jest not yet supporting pkg.exports which has been unflagged (but is still an experimental API) in Node.js 14.x?

I think we are tracking this issue in #451.

@ctavan
Copy link
Member

ctavan commented Jun 5, 2020

As noted in stackoverflow I think adding a default export to the esm build (while the CommonJS package does not have a default export) just for the sake of working around a current flaw in jest is not justified.

I think it even has the potential of doing more harm than good because it will make testing pkg.exports support which is currently being developed for jest (jestjs/jest#9771) much harder.

@franciscop
Copy link
Author

@ctavan I think it's useful for people to be able to use the library either way, but if it was purposefully removed I'll close this PR.

On the jest side, it's only until they support "Package Exports", so it only fixes a temporary bug. I explained it in detail on StackOverflow.

@franciscop franciscop closed this Jun 8, 2020
@franciscop franciscop deleted the patch-1 branch June 8, 2020 13:35
@ctavan
Copy link
Member

ctavan commented Jun 8, 2020

OK. I prefer to solve this on the jest side of things.

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.

2 participants