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

React Native: this package itself specifies a main module field that could not be resolved ---/node_modules/graphql-request/index. #548

Closed
skittlesaur opened this issue Jun 29, 2023 · 2 comments

Comments

@skittlesaur
Copy link

I'm trying to use graphql-request v6.0.0 with expo however i keep getting this error.

image

I have updated metro.config.js to accept cjs.

const { getDefaultConfig } = require('@expo/metro-config')

const config = getDefaultConfig(__dirname)

config.resolver.sourceExts.push(
  'cjs'
)

module.exports = config
@OliverRM
Copy link

The package.json of graphql-request uses the new exports syntax instead of the main field to specify the main entry point of the module. The support in react-native for the new syntax is still in beta, see this disussion.

Anyway, this should not be a problem with the most recent versions of graphql-request as the main field has been added a few months ago.

In an old version of the readme.md this problem has been explained in more detail including a workaround. After the main field has been added to the package.json, the section in the readme has been removed.

@jasonkuhrt
Copy link
Owner

Next version of this package will be ESM only. So this "bug" would be expected then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants