graphql-js
graphql-js copied to clipboard
Multiple "graphql" instances with npm link
When I connect my other module to the main application using npm link, an error appears: "Cannot use GraphQLObjectType "Query" from another module or realm."
- Graphql versions are the same in both modules.
- There are no other graphics folders in the node_modules folder
- All versions of graphql in npm ls are identical. What could be the problem?
- GraphQL added to peerDependencies in the plug-in
- The options with the removal of package-lock, resolution and npm dedupe did not work. And the problem only occurs with npm link.
This is expected yes, you can use an alias to always resolve to the local node_modules or ensure that you use a link (unlike npm) which won't allow usage of node_modules of the symlinked package.
The issue here is that you symlink to a second folder which has its own version of GraphQL while if you build and publish that library/... you will mark graphql as external and add it to peerDependencies hence this won't happen.