Skip to content

Graphql should be a peerDependency #82

Closed
@adarnon

Description

@adarnon
  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary

This package's package.json defines a forced resolution of graphql to ^15.4.0. Graphql 15.5 was just released, and this is causing a problem with yarn's resolution:

    Error: Cannot use GraphQLScalarType "String" 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.
        at instanceOf (***redacted***/node_modules/graphql-codegen-plugin-typescript-swr/node_modules/@graphql-codegen/visitor-plugin-co
mmon/node_modules/graphql/jsutils/instanceOf.js:29:13)
        at Object.isScalarType (***redacted***/node_modules/graphql-codegen-plugin-typescript-swr/node_modules/@graphql-codegen/visitor-
plugin-common/node_modules/graphql/type/definition.js:109:34)
        at ***redacted***/node_modules/graphql-codegen-plugin-typescript-swr/node_modules/@graphql-codegen/visitor-plugin-common/index.c
js.js:371:37
        at Array.filter (<anonymous>)
        at buildScalars (***redacted***/node_modules/graphql-codegen-plugin-typescript-swr/node_modules/@graphql-codegen/visitor-plugin-
common/index.cjs.js:371:14)
        at new ClientSideBaseVisitor (***redacted***/node_modules/graphql-codegen-plugin-typescript-swr/node_modules/@graphql-codegen/vi
sitor-plugin-common/index.cjs.js:2081:22)
        at new SWRVisitor (***redacted***/node_modules/graphql-codegen-plugin-typescript-swr/build/main/visitor.js:45:9)
        at Object.plugin (***redacted***/node_modules/graphql-codegen-plugin-typescript-swr/build/main/index.js:19:21)
        at executePlugin (***redacted***/node_modules/@graphql-codegen/core/index.cjs.js:38:35)
        at async ***redacted***/node_modules/@graphql-codegen/core/index.cjs.js:116:24
        at async Promise.all (index 3)
        at async Object.codegen (***redacted***/node_modules/@graphql-codegen/core/index.cjs.js:106:20)
        at async process (***redacted***/node_modules/@graphql-codegen/cli/bin.js:940:56)
        at async Promise.all (index 0)
        at async ***redacted***/node_modules/@graphql-codegen/cli/bin.js:947:37
        at async Task.task (***redacted***/node_modules/@graphql-codegen/cli/bin.js:725:17)
    Error: Cannot use GraphQLScalarType "String" from another module or realm.

I think that forcing a resolution in package.json in my project would work, but there is no reason for this package to also force the resolution internally.

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions