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

Support yarn's "resolutions" fields #212

Open
jesstelford opened this issue Dec 18, 2018 · 3 comments
Open

Support yarn's "resolutions" fields #212

jesstelford opened this issue Dec 18, 2018 · 3 comments

Comments

@jesstelford
Copy link

Title Description
Type Feature Request
Short Description Support yarn's "resolutions" fields

I have a Bolt monorepo setup with a graphql server in packages/server, and a Gatsby site in packages/website:

packages/server/package.json

{
  "dependencies": {
    "graphql": "^14.0.0"
  }
}

packages/website/package.json

{
  "scripts": {
    "start": "gatsby develop"
  },
  "dependencies": {
    "gatsby": "^2.0.0"
  }
}

After running bolt, then cd packages/website && yarn start, I get this error:

error Cannot use GraphQLScalarType "JSON" 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.

I can confirm multiple versions of graphql with yarn why:

❯ yarn why graphql
=> Found "[email protected]"
info Has been hoisted to "graphql"
info This module exists because it's specified in "dependencies".
=> Found "gatsby#[email protected]"
info This module exists because "gatsby" depends on it.
=> Found "relay-compiler#[email protected]"
info This module exists because "gatsby#relay-compiler" depends on it.

Adding a resolutions field to packages/website/package.json:

{
  "resolutions": {
    "gatsby/**/graphql": "^14.0.0"
  }
}

Doesn't make any different (appears to be ignored entirely).

@lukebatchelor
Copy link
Member

Hmm... That should work exactly the same as yarn, the installation is still handled completely by yarn, so resolutions should behave identically.

Can you confirm if you're seeing the same results just using yarn?

@philkeys
Copy link

@jesstelford Hey Jess. I was wondering if you were able to find a solution or a workaround for this issue. I've only recently ran into it.

@lukebatchelor
Copy link
Member

Hi Phil, I replied above.

Bolt doesn't do anything special with installation. It will resolve in exactly the same way as yarn, the only difference is that it symlinks at the end?

Can you explain what the issue you're seeing is?

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

No branches or pull requests

3 participants