I'm using npm link
to change my private package and see changes in action in another project. The problem is that both my projects use graphql
as a dependency so I get an error Cannot use GraphQLSchema "[object GraphQLSchema]"
I was trying to use resolutions
key in package.json of my main project. Unfortunately it didn't help. So, I'm clueless about how to resolve this issue without pushing a newer version of my package to npm
Asked
Active
Viewed 1,298 times
4

Le garcon
- 7,197
- 9
- 31
- 46
1 Answers
3
To get around this do the following
npm i -g graphql
- For each dependant project, inside the working directory
npm link graphql
This will connect to the globally installed graphql for each project and allow you to share the module without the shared directory structure

major-mann
- 2,602
- 22
- 37
-
You can also npm link the copy of graphql from your private package (rather than installing globally): in the private package `cd node_modules/graphql; npm link` then in dependent projects `npm link graphql`. – medmunds Jun 17 '19 at 19:59