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

feat: convert to ESM/CJS hybrid package #1288

Closed
wants to merge 1 commit into from
Closed

Conversation

yinzara
Copy link

@yinzara yinzara commented Sep 13, 2021

As outlined in #1263, the NodeJS ecosystem is not yet prepared for a package as major as node-fetch being ESM only.

This PR adds cross transpilation of the 3.0.0 ESM version of node-fetch using esbuild as a prepack step before publishing and configuration in the package.json to allow for both styles of imports.

For ESM only packages that use node-fetch, they should be able to 'tree shake' the CJS files so they don't impact application size.

For CJS packages, they can continue to use node-fetch as they originally did with the understanding that in the future this support could be removed.

I have updated documentation to reflect the change.

This should allow abandonment of the 2.x branch.

@jimmywarting
Copy link
Collaborator

Locking this as a duplicate of #1227

There is no point to submit more variant of this solution unless you first can convince some of the maintainer that this is something we want to support.

It's not enough to argument why it should be supported and what all the benefits are. You also have to understand what the drawbacks of what this means to bundle all the things to cjs... Something which is not mentioned at all in this PR.

@node-fetch node-fetch locked as too heated and limited conversation to collaborators Sep 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants