Skip to content

Conversation

@dnalborczyk
Copy link
Contributor

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • New feature
  • Other, please explain:

adds an exports field to package.json which limits the accessibility to index.js only.

What changes did you make? (provide an overview)

Which issue (if any) does this pull request address?

Is there anything you'd like reviewers to know?

@LinusU
Copy link
Member

LinusU commented Oct 22, 2021

I really wish that we would have done this before 3.0.0 😅

I'm not sure we can do this now since this technically breaks things that worked before, e.g. import Body from 'node-fetch/src/body.js'

On the other hand one could argue that it was never supported nor documented. Will have to see what the other maintainers thinks...

@dnalborczyk
Copy link
Contributor Author

I'm not sure we can do this now since this technically breaks things that worked before, e.g. import Body from 'node-fetch/src/body.js'

I agree, "technically" it's a breaking change, but that would also technically prevent you from ever doing any refactoring as well without a major version release, as someone could also depend on e.g. formDataIterator which is not meant to be exposed at all. I also think that an import like import Body from 'node-fetch/src/body.js' is also easily fixable.

On the other hand one could argue that it was never supported nor documented. Will have to see what the other maintainers thinks...

I agree. as far as I noticed, people usually treated their non-documented code not as semver major changes. exports is just helping to enforce it. the other thing is also that the esm release is fairly new, and there's likely less(er) adoption right now (just a bad guess, as npm stats are somewhat useless in that regard). a bunch of those 3.x downloads are also likely accidental, until people notice that this esm version does not work in their cjs project, and re-install v2.x afterwards.

if anyone feels really strongly about it tho: "integers are cheap" 😉 I personally don't think it's a big deal to release 4.0, even shortly after a 3.0.

@jimmywarting jimmywarting changed the title chore: add package.json exports field fix(package): add exports field in package.json Nov 9, 2021
@jimmywarting jimmywarting changed the title fix(package): add exports field in package.json fix(package): Add exports field in package.json Nov 9, 2021
@jimmywarting jimmywarting added this to the Version 4.0.0 milestone Dec 31, 2021
@jimmywarting jimmywarting mentioned this pull request Jan 14, 2022
31 tasks
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