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

fix(esm): added export mapping to package.json for proper cjs/esm entrypoints #4081

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

favna
Copy link

@favna favna commented May 6, 2024

With the current code that doesn't define export mapping modern tooling such as vitest v1.6.0 tries to access the CJS version of GraphQL in my project (https://github.com/favware/graphql-pokemon) because it doesn't know where to find the ESM version. This subsequently causes the error:

Cannot use GraphQLNonNull "Ability!" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

https://yarnpkg.com/en/docs/selective-version-resolutions

Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.

By following the modern system of defining package entrypoints through the exports mapping this problem is solved because now vitest will properly access the ESM variant for graphql.

Copy link

linux-foundation-easycla bot commented May 6, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

Copy link

netlify bot commented May 6, 2024

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit e47fb5f
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/6638ea1be863740008e525e2
😎 Deploy Preview https://deploy-preview-4081--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@favna
Copy link
Author

favna commented Jun 16, 2024

@benjie What is the way GraphQL addresses community bug fix PRs? I see GraphQL 16.8.2 got merged with a single bug fix as well and to be frank I'd say this one is equally as important because it also addresses bundlers and shipping code on modern ESM stacks.

@benjie
Copy link
Member

benjie commented Jul 1, 2024

What is the way GraphQL addresses community bug fix PRs?

GraphQL is a community operated technology, so all bug fix PRs are community bug fix PRs. Contributors are encouraged to represent their fixes at a GraphQL.js WG where it can be discussed with other community members; you can add yourself to an agenda here: https://github.com/graphql/graphql-js-wg/tree/main/agendas/2024

If you can't make any meetings (for example, due to timezone concerns) then you can request someone to represent a topic for you - hopefully someone else agrees with the need for the feature and will then represent it on your behalf.

to be frank I'd say this one is equally as important

We agree that this is important; there's active research being conducted that relates to (and predates) your PR - please see #4074 for more details.

@favna
Copy link
Author

favna commented Jul 19, 2024

I keep procrastinating preparing something and signing up but I do feel like I want to. The timezone should be fine just fine, I'm from The Netherlands so only 2 hours ahead of UTC.

@benjie
Copy link
Member

benjie commented Jul 20, 2024

We’d love to see you there! Unfortunately I can’t make either of the next two meetings but I plan to be there in September.

@yaacovCR yaacovCR mentioned this pull request Sep 27, 2024
17 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.

2 participants